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

23 lines
446 B
JavaScript
Raw Permalink Normal View History

2024-10-30 22:30:09 +01:00
'use strict';
// Fake 'now' date time for testing
const fakeNow = null;
// Test transitions
// const fakeNow = Date.parse("2024-10-31T19:05: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
}