Set default time zone for Luxon instead of setting the time zone on each DateTime object

pull/248/head
ElementalAlchemist 3 years ago committed by Mike Lang
parent 0340f06170
commit 5a9f4502c2

@ -1,7 +1,8 @@
var DateTime = luxon.DateTime;
var Interval = luxon.Interval;
luxon.Settings.defaultZone = "utc";
var globalBusStartTime = DateTime.fromISO("1970-01-01T00:00:00", { zone: "utc" });
var globalBusStartTime = DateTime.fromISO("1970-01-01T00:00:00");
var globalStreamName = "";
var globalStartTimeString = "";
var globalEndTimeString = "";
@ -131,7 +132,7 @@ function formatIntervalForDisplay(interval) {
}
function dateTimeFromWubloaderTime(wubloaderTime) {
return DateTime.fromISO(wubloaderTime, { zone: "utc" });
return DateTime.fromISO(wubloaderTime);
}
function wubloaderTimeFromDateTime(dateTime) {

@ -234,7 +234,7 @@ async function loadVideoInfo() {
async function initializeVideoInfo() {
globalStreamName = videoInfo.video_channel;
globalBusStartTime = DateTime.fromISO(videoInfo.bustime_start, { zone: "utc" });
globalBusStartTime = DateTime.fromISO(videoInfo.bustime_start);
let eventStartTime = dateTimeFromWubloaderTime(videoInfo.event_start);
let eventEndTime = videoInfo.event_end ? dateTimeFromWubloaderTime(videoInfo.event_end) : null;
@ -1011,7 +1011,7 @@ function dateTimeFromVideoPlayerTime(videoPlayerTime) {
if (segmentStartISOTime === undefined) {
return null;
}
const wubloaderDateTime = DateTime.fromISO(segmentStartISOTime, { zone: "utc" });
const wubloaderDateTime = DateTime.fromISO(segmentStartISOTime);
const offset = videoPlayerTime - segmentStartTime;
return wubloaderDateTime.plus({ seconds: offset });
}

@ -53,7 +53,7 @@ async function loadDefaults() {
const streamNameField = document.getElementById("stream-time-setting-stream");
streamNameField.value = defaultData.video_channel;
globalBusStartTime = DateTime.fromISO(defaultData.bustime_start, { zone: "utc" });
globalBusStartTime = DateTime.fromISO(defaultData.bustime_start);
}
// Gets the start time of the video from settings. Returns an invalid date object if the user entered bad data.

Loading…
Cancel
Save