66 lines
2.7 KiB
TypeScript
66 lines
2.7 KiB
TypeScript
// Module ID: 7387
|
|
// Function ID: 7388
|
|
// Name: getDurationString
|
|
// Dependencies: [1236, 4075, 2]
|
|
// Exports: default, getAbbreviatedFormatter, getFullFormatter
|
|
|
|
// Module 7387 (getDurationString)
|
|
import set from "set" /* 2 */;
|
|
import getSystemLocale from "getSystemLocale" /* 1236 */;
|
|
import hooksDefault from "hooks" /* 4075 */;
|
|
|
|
function getDurationString(seconds) {
|
|
seconds = seconds.seconds;
|
|
const formatter = seconds.getFormatter();
|
|
if (seconds < 60) {
|
|
const intl6 = getSystemLocale.intl;
|
|
let formatToPlainStringResult = intl6.formatToPlainString(formatter.minutes, { minutes: 1 });
|
|
} else if (seconds < 3600) {
|
|
const intl5 = getSystemLocale.intl;
|
|
let obj = { minutes: null };
|
|
const _Math5 = Math;
|
|
obj[0] = Math.floor(seconds / 60);
|
|
formatToPlainStringResult = intl5.formatToPlainString(formatter.minutes, obj);
|
|
} else if (seconds < 86400) {
|
|
const intl4 = getSystemLocale.intl;
|
|
obj = { hours: null };
|
|
const _Math4 = Math;
|
|
obj[0] = Math.floor(seconds / 3600);
|
|
formatToPlainStringResult = intl4.formatToPlainString(formatter.hours, obj);
|
|
} else if (seconds < c3) {
|
|
const intl3 = getSystemLocale.intl;
|
|
obj1 = { days: null };
|
|
const _Math3 = Math;
|
|
obj1[0] = Math.floor(seconds / 86400);
|
|
formatToPlainStringResult = intl3.formatToPlainString(formatter.days, obj1);
|
|
} else if (seconds < c4) {
|
|
const intl2 = getSystemLocale.intl;
|
|
const obj2 = { months: null };
|
|
const _Math2 = Math;
|
|
obj2[0] = Math.floor(seconds / tmp20);
|
|
formatToPlainStringResult = intl2.formatToPlainString(formatter.months, obj2);
|
|
} else {
|
|
const intl = getSystemLocale.intl;
|
|
obj = { years: null };
|
|
const _Math = Math;
|
|
obj[0] = Math.floor(seconds / tmp21);
|
|
formatToPlainStringResult = intl.formatToPlainString(formatter.years, obj);
|
|
}
|
|
return formatToPlainStringResult;
|
|
}
|
|
let c3 = 2592000;
|
|
let c4 = 31104000;
|
|
const result = set.fileFinishedImporting("modules/notification_center/getTimestampString.tsx");
|
|
|
|
export default function getTimestampString(arg0) {
|
|
const obj = { seconds: hooksDefault().diff(hooksDefault(since), "s"), getFormatter };
|
|
({ since, getFormatter } = arg0);
|
|
return getDurationString(obj);
|
|
};
|
|
export const getAbbreviatedFormatter = function getAbbreviatedFormatter() {
|
|
return { minutes: getSystemLocale.t["XIGt+W"], hours: getSystemLocale.t.rhY1Rs, days: getSystemLocale.t.GBLpQ8, months: getSystemLocale.t.XzBNbS, years: getSystemLocale.t.I1E8p6 };
|
|
};
|
|
export const getFullFormatter = function getFullFormatter() {
|
|
return { minutes: getSystemLocale.t["GqQ/Y9"], hours: getSystemLocale.t.c5zfWZ, days: getSystemLocale.t.amjnaI, months: getSystemLocale.t.SoON3V, years: getSystemLocale.t["12B3Re"] };
|
|
};
|
|
export { getDurationString };
|