From 258e80245ce39738c0d5f4a17dcc64d525365f52 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 6 Feb 2020 23:39:08 +0000 Subject: [PATCH] --- ayanova/package-lock.json | 5 ++++ ayanova/package.json | 1 + ayanova/src/api/initialize.js | 3 +-- ayanova/src/components/date-time-control.vue | 26 +++++++++++++++++++- ayanova/src/main.js | 2 ++ 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/ayanova/package-lock.json b/ayanova/package-lock.json index 7bfc7b16..5b94fb13 100644 --- a/ayanova/package-lock.json +++ b/ayanova/package-lock.json @@ -13846,6 +13846,11 @@ "yallist": "^2.1.2" } }, + "luxon": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.22.0.tgz", + "integrity": "sha512-3sLvlfbFo+AxVEY3IqxymbumtnlgBwjDExxK60W3d+trrUzErNAz/PfvPT+mva+vEUrdIodeCOs7fB6zHtRSrw==" + }, "make-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", diff --git a/ayanova/package.json b/ayanova/package.json index 75074ff4..8b1ddf88 100644 --- a/ayanova/package.json +++ b/ayanova/package.json @@ -14,6 +14,7 @@ "core-js": "^3.6.1", "dayjs": "^1.8.18", "jwt-decode": "^2.2.0", + "luxon": "^1.22.0", "nprogress": "^0.2.0", "register-service-worker": "^1.6.2", "typeface-roboto": "0.0.75", diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 1c3ffbd5..d283abce 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -19,9 +19,8 @@ export default function initialize() { //Fetch the core localized text keys that will always be required by user window.$gz.locale .fetch(window.$gz.locale.coreKeys) - .then(function initializeNavPanel() { - console.log("INIT NAV PANEL"); + // console.log("INIT NAV PANEL"); var key = 0; var sub = []; diff --git a/ayanova/src/components/date-time-control.vue b/ayanova/src/components/date-time-control.vue index 45b19983..f9fd5839 100644 --- a/ayanova/src/components/date-time-control.vue +++ b/ayanova/src/components/date-time-control.vue @@ -235,7 +235,31 @@ export default { return window.$gz.locale.utcDateStringTo8601TimeOnlyString(this.value); }, set(value) { - //this.value = value; + //https://moment.github.io/luxon/docs/manual/zones.html#creating-datetimes-in-a-zone + //var overrideZone = DateTime.fromISO("2017-05-15T09:10:23", { zone: "Europe/Paris" }); + //set this.date to utc iso string based on incoming value which is same format as set above + //so need to take the time portion, construct a date object + console.log("timeOnly:set value incoming is:"); + console.log(value); + + console.log("this.value is:"); + console.log(this.value); + + console.log("Attempting parse from:"); + console.log(this.dateOnly + "T" + value); + + var overrideZone = window.$gz.DateTime.fromISO( + this.dateOnly + "T" + value, + { zone: this.timeZoneName } + ); + console.log("timeOnly:conversion to overrideZone:"); + console.log(overrideZone.toString()); + var utcZoned = overrideZone.setZone("utc"); + + console.log("output as utc iso string:"); + console.log(utcZoned.toISO()); + + //this.date=overrideZone.dt.toISO(); } } } diff --git a/ayanova/src/main.js b/ayanova/src/main.js index 28564b00..5518051f 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -11,6 +11,7 @@ import errorHandler from "./api/errorhandler"; import NProgress from "nprogress"; import "nprogress/nprogress.css"; import dayjs, { Dayjs } from "dayjs"; +import { DateTime } from "luxon"; import UTC from "dayjs/plugin/utc"; // load on demand dayjs.extend(UTC); // use plugin import lodash from "./libs/lodash.min.js"; @@ -57,6 +58,7 @@ window.$gz = { dialog: gzdialog, util: gzutil, dayjs: dayjs, + DateTime: DateTime, _: lodash, api: gzapi, form: gzform,