This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/server/overload.js

19 lines
429 B
JavaScript

const overloadPeriods = {
// en: [[15, 24]],
// pl: [[0, 24]],
};
module.exports = (locale, timestamp = new Date) => {
if (overloadPeriods[locale] === undefined) {
return false;
}
for (let [periodStart, periodEnd] of overloadPeriods[locale]) {
if (timestamp.getUTCHours() >= periodStart && timestamp.getUTCHours() < periodEnd) {
return true;
}
}
return false;
}