decord/source/modules/polls/chat/useFormattedExpirationLabel.tsx

45 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8477
// Function ID: 8478
2026-07-20 16:05:17 +00:00
// Name: formatExpirationLabel
2026-08-25 06:04:03 +00:00
// Dependencies: [3979, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 8477 (formatExpirationLabel)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
2026-08-25 06:04:03 +00:00
import hooksDefault from "hooks" /* 3979 */;
2026-08-24 06:08:38 +00:00
2026-07-20 16:05:17 +00:00
function formatExpirationLabel(expiry) {
2026-08-25 06:04:03 +00:00
const tmp2 = hooksDefault();
2026-07-29 08:29:29 +00:00
if (expiry > tmp2) {
const diffResult = expiry.diff(tmp2, "days");
2026-07-20 16:05:17 +00:00
if (diffResult > 1) {
2026-08-24 06:08:38 +00:00
const intl3 = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
let obj = { days: null };
obj[0] = diffResult;
2026-08-24 06:08:38 +00:00
return intl3.formatToPlainString(getSystemLocale.t.dex68a, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const diffResult1 = expiry.diff(tmp2, "hours");
2026-07-20 16:05:17 +00:00
if (diffResult1 > 1) {
2026-08-24 06:08:38 +00:00
const intl2 = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
obj = { hours: null };
obj[0] = diffResult1;
2026-08-24 06:08:38 +00:00
return intl2.formatToPlainString(getSystemLocale.t.BWqf0c, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
obj = { minutes: null };
obj[0] = expiry.diff(tmp2, "minutes");
2026-08-24 06:08:38 +00:00
return intl.formatToPlainString(getSystemLocale.t["3SLXAz"], obj);
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/polls/chat/useFormattedExpirationLabel.tsx");
2026-07-20 16:05:17 +00:00
export default function useFormattedExpirationLabel(expiry) {
if (null != expiry) {
return formatExpirationLabel(expiry);
}
};
export { formatExpirationLabel };