html5-infobeamer-dhcp/assets/js/custom/core/time.js

44 lines
1.3 KiB
JavaScript

'use strict';
// Fake 'now' date time for testing
// const fakeNow = null;
// Test transitions
// const fakeNow = Date.parse("2024-03-01T18:53:50");
// Test Fr
const fakeNow = Date.parse("2024-03-01T19:00:00");
// const fakeNow = Date.parse("2024-03-01T19:15:00");
// const fakeNow = Date.parse("2024-03-01T20:15:00");
// const fakeNow = Date.parse("2024-03-01T21:00:00");
// Test Sa
// const fakeNow = Date.parse("2024-03-02T11:00:00");
// const fakeNow = Date.parse("2024-03-02T11:15:00");
// const fakeNow = Date.parse("2024-03-02T12:00:00");
// const fakeNow = Date.parse("2024-03-02T13:00:00");
// const fakeNow = Date.parse("2024-03-02T14:45:00");
// const fakeNow = Date.parse("2024-03-02T15:30:00");
// const fakeNow = Date.parse("2024-03-02T16:30:00");
// const fakeNow = Date.parse("2024-03-02T18:00:00");
// const fakeNow = Date.parse("2024-03-02T19:00:00");
// const fakeNow = Date.parse("2024-03-02T20:00:00");
// const fakeNow = Date.parse("2024-03-02T20: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
}