From f75d78af070a9604a021161f03911139d48981df Mon Sep 17 00:00:00 2001 From: Lucas Li Date: Tue, 29 Oct 2024 14:51:14 -0700 Subject: [PATCH 1/2] The PDT/PST suffix on a timestamp on the full details page needs to automatically adjust depending on the time of the year --- .../src/main/angular/src/app/utils/index.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/wfnews-war/src/main/angular/src/app/utils/index.ts b/client/wfnews-war/src/main/angular/src/app/utils/index.ts index 57e8f0ca2..63be5f50b 100644 --- a/client/wfnews-war/src/main/angular/src/app/utils/index.ts +++ b/client/wfnews-war/src/main/angular/src/app/utils/index.ts @@ -598,8 +598,8 @@ export function getStageOfControlIcon(code: string) { } } -export function convertToDateTimeTimeZone(date) { - // e.g. July 19, 2022 at 10:22 a.m. PST +export function convertToDateTimeTimeZone(date: Date | string): string { + // e.g. July 19, 2022 at 10:22 a.m. PST/PDT const updateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', @@ -607,11 +607,14 @@ export function convertToDateTimeTimeZone(date) { hour: 'numeric', minute: 'numeric', second: undefined, // this removes the seconds + timeZone: 'America/Los_Angeles', // Pacific Time Zone + timeZoneName: 'short', // Automatically handles PDT/PST }; - let convertedDate: string; - convertedDate = date - ? new Date(date).toLocaleTimeString('en-US', updateOptions) + ' PST' + + let convertedDate = date + ? new Date(date).toLocaleString('en-US', updateOptions) : 'Pending'; + if (convertedDate !== 'Pending') { // add full stops and lowercase convertedDate = convertedDate.replace('AM', 'a.m.'); From ab43e7ee5c34cbb511557784214731e22d29c0ed Mon Sep 17 00:00:00 2001 From: Lucas Li Date: Tue, 29 Oct 2024 21:22:20 -0700 Subject: [PATCH 2/2] remove timezone for convertToDateTimeTimeZone() --- client/wfnews-war/src/main/angular/src/app/utils/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/client/wfnews-war/src/main/angular/src/app/utils/index.ts b/client/wfnews-war/src/main/angular/src/app/utils/index.ts index 63be5f50b..ef8a76e86 100644 --- a/client/wfnews-war/src/main/angular/src/app/utils/index.ts +++ b/client/wfnews-war/src/main/angular/src/app/utils/index.ts @@ -607,7 +607,6 @@ export function convertToDateTimeTimeZone(date: Date | string): string { hour: 'numeric', minute: 'numeric', second: undefined, // this removes the seconds - timeZone: 'America/Los_Angeles', // Pacific Time Zone timeZoneName: 'short', // Automatically handles PDT/PST };