Files
discord-decomp/modules/notification_center/getTimestampString.tsx
T
2026-11-01 12:12:55 +02:00

49 lines
1.4 KiB
TypeScript

// Metro module 5928 (f5929).
import { intl, t } from "../../intl/index.native";
import Module3771 from "../../_bundle/Module3771";
let c3713_3, c3713_4;
const getDurationString = function getDurationString(a0) {
const seconds = a0.seconds;
const r8 = (0, a0.getFormatter)();
return seconds < 60 ? intl.formatToPlainString(r8.minutes, {
minutes: 1
}) : seconds < 3600 ? intl.formatToPlainString(r8.minutes, {
minutes: Math.floor(seconds / 60)
}) : seconds < 86400 ? intl.formatToPlainString(r8.hours, {
hours: Math.floor(seconds / 3600)
}) : seconds < c3713_3 ? intl.formatToPlainString(r8.days, {
days: Math.floor(seconds / 86400)
}) : seconds < c3713_4 ? intl.formatToPlainString(r8.months, {
months: Math.floor(seconds / c3713_3)
}) : intl.formatToPlainString(r8.years, {
years: Math.floor(seconds / c3713_4)
});
};
c3713_3 = 2592000;
c3713_4 = 31104000;
export default function getTimestampString({ since, getFormatter }) {
return getDurationString({
seconds: Module3771().diff(Module3771(since), "s"),
getFormatter
});
};
export function getAbbreviatedFormatter() {
return {
minutes: t["XIGt+W"],
hours: t.rhY1Rs,
days: t.GBLpQ8,
months: t.XzBNbS,
years: t.I1E8p6
};
}
export function getFullFormatter() {
return {
minutes: t["GqQ/Y9"],
hours: t.c5zfWZ,
days: t.amjnaI,
months: t.SoON3V,
years: t["12B3Re"]
};
}
export { getDurationString };