PronounsPage/server/overload.ts
Valentyne Stigloher 10180aa6a3 (refactor) use #shared alias instead of ~~/shared
the #shared alias used by Nuxt cannot be easily disabled and to prevent breackage with jiti, we make use of it
2025-08-17 18:56:02 +02:00

21 lines
520 B
TypeScript

import { newDate } from '#shared/helpers.ts';
const overloadPeriods: Record<string, number[][]> = {
// en: [[15, 24]],
// pl: [[0, 24]],
};
export default (locale: string, timestamp: Date = newDate()) => {
if (overloadPeriods[locale] === undefined) {
return false;
}
for (const [periodStart, periodEnd] of overloadPeriods[locale]) {
if (timestamp.getUTCHours() >= periodStart && timestamp.getUTCHours() < periodEnd) {
return true;
}
}
return false;
};