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

44 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-01-08 21:32:04 +01:00
'use strict';
// Fake 'now' date time for testing
2024-02-28 20:59:27 +01:00
const fakeNow = null;
2024-01-08 21:32:04 +01:00
// Test transitions
// const fakeNow = Date.parse("2024-03-01T18:53:50");
// Test Fr
2024-02-28 20:59:27 +01:00
// const fakeNow = Date.parse("2024-03-01T19:00:00");
2024-01-08 21:32:04 +01: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
}