dgwk25-huginfo/assets/js/custom/core/time.js

43 lines
1.3 KiB
JavaScript

'use strict';
// Fake 'now' date time for testing
const fakeNow = null;
// Test transitions
//const fakeNow = Date.parse("2025-02-28T18:53:50");
// Test Fr
//const fakeNow = Date.parse("2025-02-28T19:00:00");
//const fakeNow = Date.parse("2025-02-28T19:15:00");
//const fakeNow = Date.parse("2025-02-28T20:15:00");
//const fakeNow = Date.parse("2025-02-28T21:15:00");
// Test Sa
//const fakeNow = Date.parse("2025-03-01T11:00:00");
//const fakeNow = Date.parse("2025-03-01T11:15:00");
//const fakeNow = Date.parse("2025-03-01T12:00:00");
//const fakeNow = Date.parse("2025-03-01T13:00:00");
//const fakeNow = Date.parse("2025-03-01T14:30:00");
//const fakeNow = Date.parse("2025-03-01T14:45:00");
//const fakeNow = Date.parse("2025-03-01T15:30:00");
//const fakeNow = Date.parse("2025-03-01T16:30:00");
//const fakeNow = Date.parse("2025-03-01T18:00:00");
//const fakeNow = Date.parse("2025-03-01T19:00:00");
//const fakeNow = Date.parse("2025-03-01T20:00:00");
//const fakeNow = Date.parse("2025-03-01T20:15:00");
const fakeTimeDelta = fakeNow === null ? 0 : fakeNow - Date.now();
// Real 'now' date time for production
const nowJS = () => Date.now() + fakeTimeDelta;
// Real 'now' date time for production as luxon DateTime object
const now = () => luxon.DateTime.fromMillis(nowJS());
export {
now
}