We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac3566e commit 1a14594Copy full SHA for 1a14594
src/helpers/datetime-helper.js
@@ -1,10 +1,9 @@
1
const { DateTime } = require('luxon');
2
3
function getDateTime(ianaTimezone, dateString, timeString) {
4
+ // Node pulls the timezone from the system on initialisation using the TZ environment variable.
5
+ // We can change process.env.TZ to UTC. This will update the current Node process.
6
process.env.TZ = 'UTC';
- if (process.env.TZ !== 'UTC') {
- throw new Error(`Schedule generation logic relies on 'TZ' env var being set to 'UTC'. It is currently: ${process.env.TZ}`);
7
- }
8
if (typeof dateString !== 'undefined' && typeof timeString !== 'undefined') {
9
return DateTime.fromISO(`${dateString}T${timeString}`, { zone: ianaTimezone }).toJSDate();
10
}
0 commit comments