Files
discord-decomp/modules/custom_status/utils/formatClearAfterValue.tsx
T
2026-11-01 12:12:55 +02:00

57 lines
1.8 KiB
TypeScript

// Metro module 11983 (f11984).
import { ClearAfterValues } from "../Constants";
import { isSameDay } from "../../../utils/DateUtils";
import { intl, t } from "../../../intl/index.native";
import Durations from "../../../utils/Durations";
import { assertNever } from "../../../utils/GlobalUtils";
export default function formatClearAfterValue(a0) {
if (ClearAfterValues.TODAY === a0) {
const DAY = Durations.Millis.DAY;
const r187 = Date.now() + DAY;
return isSameDay(new Date(), new Date(r187)) ? intl.data.formatTime(r187, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r187, {
format: "short"
})
});
}
if (ClearAfterValues.HOURS_4 === a0) {
const r134 = 4 * Durations.Millis.HOUR;
const r139 = Date.now() + r134;
return isSameDay(new Date(), new Date(r139)) ? intl.data.formatTime(r139, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r139, {
format: "short"
})
});
}
if (ClearAfterValues.HOURS_1 === a0) {
const HOUR = Durations.Millis.HOUR;
const r89 = Date.now() + HOUR;
return isSameDay(new Date(), new Date(r89)) ? intl.data.formatTime(r89, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r89, {
format: "short"
})
});
}
if (ClearAfterValues.MINUTES_30 === a0) {
const r42 = 30 * Durations.Millis.MINUTE;
const r7 = Date.now() + r42;
return isSameDay(new Date(), new Date(r7)) ? intl.data.formatTime(r7, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r7, {
format: "short"
})
});
}
if (ClearAfterValues.DONT_CLEAR === a0) {
return intl.string(t.bRn8cq);
}
assertNever(a0);
};