From 346b27ac1d7d823f4e6a42c5bd77e22b4f22afe2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 17 Sep 2021 22:30:52 +0000 Subject: [PATCH] --- ayanova/src/api/locale.js | 20 ++++++++++++++++++++ ayanova/src/views/home-schedule.vue | 20 ++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 95009bd1..95246c10 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -101,6 +101,26 @@ export default { }) ).getTime(); }, + /////////////////////////////////////////////// + // Convert a local schedule epoch timestamp + // to UTC and output as ISO 8601 + // + // + localScheduleFormatToUTC8601String(value, timeZoneName) { + if (!timeZoneName) { + timeZoneName = this.getResolvedTimeZoneName(); + } + + //parse in the time in the currently used timezone + let ret = window.$gz.DateTime.fromMillis(value, { + zone: timeZoneName + }); + + ret = ret.setZone("utc"); //convert to UTC + ret = ret.toISO(); //output as ISO 8601 + + return ret; + }, /////////////////////////////////////////// // Turn a utc date into a displayable // short date and time diff --git a/ayanova/src/views/home-schedule.vue b/ayanova/src/views/home-schedule.vue index 3de674eb..d1349d05 100644 --- a/ayanova/src/views/home-schedule.vue +++ b/ayanova/src/views/home-schedule.vue @@ -392,13 +392,25 @@ export default { if (this.dragEvent) { param.type = this.dragEvent.type; param.id = this.dragEvent.id; - (param.start = this.dragEvent.start), - (param.end = this.dragEvent.end); + param.start = window.$gz.locale.localScheduleFormatToUTC8601String( + this.dragEvent.start, + this.timeZoneName + ); + param.end = window.$gz.locale.localScheduleFormatToUTC8601String( + this.dragEvent.end, + this.timeZoneName + ); } else { param.type = this.extendEvent.type; param.id = this.extendEvent.id; - (param.start = this.extendEvent.start), - (param.end = this.extendEvent.end); + param.start = window.$gz.locale.localScheduleFormatToUTC8601String( + this.extendEvent.start, + this.timeZoneName + ); + param.end = window.$gz.locale.localScheduleFormatToUTC8601String( + this.extendEvent.end, + this.timeZoneName + ); } //post it