From a6f3495548f6c07e8eb4439d1c8b1c6fc3111c82 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 5 Jan 2022 17:43:52 +0000 Subject: [PATCH] ops->jobs timestamp changed resolution from minutes to seconds --- ayanova/devdocs/todo.txt | 4 +-- ayanova/src/api/locale.js | 45 +++++++++++++++++++++++++++++++++- ayanova/src/views/ops-jobs.vue | 6 +++-- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 73fe6dc4..399cedb3 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -243,7 +243,7 @@ TODO: 1 BETA DOCS: | |____| |____ _| |_| |____| |\ | | | \_____|______|_____|______|_| \_| |_| -- 1 Server Jobs timestamp column doesn't show accurately enough, only resolves down to minutes + - 2 todo: put reset link somewhere in UI so user can just click on it, maybe the login form?? Or the About form? about->log form? @@ -771,7 +771,7 @@ BUILD 8.0.0-beta.0.10 CHANGES OF NOTE - Updated IIS install docs to include section on application pool settings to prevent conflicting restart or shutdown of AyaNova - case 4070 see notes - seeded data prices and costs all now rounded to 2 decimal places - +- Server Jobs timestamp column modifed from hour and minutes to now show hour minutes seconds for more accurate display diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 4dcae87a..6b64e647 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -174,7 +174,50 @@ export default { timeStyle: "short", hour12: hour12 }); - }, /////////////////////////////////////////// + }, + /////////////////////////////////////////// + // Turn a utc date into a displayable + // date and time with specific formats + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString + // + utcDateToSpecifiedDateAndTimeLocalized( + value, + timeZoneName, + languageName, + hour12, + dateStyle, + timeStyle + ) { + if (!value) { + return ""; + } + if (!timeZoneName) { + timeZoneName = this.getResolvedTimeZoneName(); + } + if (!languageName) { + languageName = this.getResolvedLanguage(); + } + + if (!hour12) { + hour12 = this.getHour12(); + } + + //parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z") + const parsedDate = new Date(value); + + //is it a valid date? + if (!(parsedDate instanceof Date && !isNaN(parsedDate))) { + return "not valid"; + } + + return parsedDate.toLocaleString(languageName, { + timeZone: timeZoneName, + dateStyle: dateStyle, + timeStyle: timeStyle, + hour12: hour12 + }); + }, + /////////////////////////////////////////// // Turn a utc date into a displayable // short date // diff --git a/ayanova/src/views/ops-jobs.vue b/ayanova/src/views/ops-jobs.vue index ef384cca..2bae5fa2 100644 --- a/ayanova/src/views/ops-jobs.vue +++ b/ayanova/src/views/ops-jobs.vue @@ -100,11 +100,13 @@ export default { const o = res.data[i]; ret.push({ id: i, - created: window.$gz.locale.utcDateToShortDateAndTimeLocalized( + created: window.$gz.locale.utcDateToSpecifiedDateAndTimeLocalized( o.created, this.timeZoneName, this.languageName, - this.hour12 + this.hour12, + "short", + "medium" ), status: await window.$gz.translation.translateStringWithMultipleKeysAsync( o.statusText