1
0

feat: Convert to modules
All checks were successful
Remote Deploy / deploy (push) Successful in 3s

This commit is contained in:
2025-08-31 16:48:40 +02:00
parent 1a29836e44
commit c82fef9e4f
9 changed files with 23 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
// Rules: start and end in 24h format, interval in minutes
const scheduleRules = [
export const scheduleRules = [
{ start: "0:00", end: "3:00", interval: 180 },
{ start: "3:00", end: "4:00", interval: 60 },
{ start: "5:00", end: "6:00", interval: 30 },
@@ -9,12 +9,12 @@ const scheduleRules = [
{ start: "19:00", end: "0:00", interval: 180 }
];
function toMinutes(timeStr) {
export function toMinutes(timeStr) {
const [h, m] = timeStr.split(":").map(Number);
return h * 60 + (m || 0);
}
function getCurrentInterval(date = new Date()) {
export function getCurrentInterval(date = new Date()) {
const nowMinutes = date.getHours() * 60 + date.getMinutes();
for (const rule of scheduleRules) {
@@ -35,9 +35,3 @@ function getCurrentInterval(date = new Date()) {
return null;
}
module.exports = {
scheduleRules,
getCurrentInterval,
toMinutes
};