From b13f3f0a5ac77393832c138bb27a6a23dee29440 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Fri, 5 Nov 2021 15:52:00 -0700 Subject: [PATCH 1/2] Convert SQL Time to ISO 8601, Safari Time Support --- static/js/base.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/static/js/base.js b/static/js/base.js index ce86c33..5c29fef 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -219,7 +219,16 @@ function doneLoading (selector) { // Other goodies function formatDate (dateString) { - return (new Date(dateString + ':00')).toLocaleString( + dateString = dateString + ':00'; + + // Replaces the first instance of a space, + // and replace with "T" to fit ISO 8601, + // which all modern browsers support + // Example: YYYY-MM-DD HH:MM:SS-TZ:tz --> YYYY-MM-DDTHH:MM:SS-TZ:tz + // Note: TZ:tz is Hour and Minutes of Time Zone + dateString = dateString.replace(' ', 'T'); + + return (new Date(dateString)).toLocaleString( localizer.locale || 'en-us', { month: 'long', day: 'numeric', year: 'numeric' } ); From 815b65cb148a73a1bfb5cf92128e8ac1bb434580 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 5 Nov 2021 20:09:10 -0700 Subject: [PATCH 2/2] Update static/js/base.js --- static/js/base.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/static/js/base.js b/static/js/base.js index 5c29fef..133ef2e 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -219,14 +219,12 @@ function doneLoading (selector) { // Other goodies function formatDate (dateString) { - dateString = dateString + ':00'; - // Replaces the first instance of a space, // and replace with "T" to fit ISO 8601, // which all modern browsers support // Example: YYYY-MM-DD HH:MM:SS-TZ:tz --> YYYY-MM-DDTHH:MM:SS-TZ:tz // Note: TZ:tz is Hour and Minutes of Time Zone - dateString = dateString.replace(' ', 'T'); + dateString = `${dateString}:00`.replace(' ', 'T'); return (new Date(dateString)).toLocaleString( localizer.locale || 'en-us',