From 07b85ef34340906a551aa68c0729ab16f10e391c Mon Sep 17 00:00:00 2001 From: Derick Montague Date: Fri, 9 Jul 2021 20:00:35 -0500 Subject: Fix cross-browser time formatting bug To format the BMC time as 24 hour time, we used the `hour12` property. In Chrome, the time between 12:00 AM and 1:00 AM is displaye as 24:xx, instead of 00:xx. The cross-browser solution is to replace the `hour12` property with the `hourCycle` property so that all the time is formatted as 00:xx. Reference for Intl.DateTimeFormat constructor https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat Signed-off-by: Derick Montague Change-Id: I68539d9602499dcb1bde9a4b01dd7a66fbc69d1a --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.js b/src/main.js index 8c72580e..8fcb8089 100644 --- a/src/main.js +++ b/src/main.js @@ -71,7 +71,7 @@ Vue.filter('formatTime', function (value) { if (isUtcDisplay) { let timeOptions = { timeZone: 'UTC', - hour12: false, + hourCycle: 'h23', }; return `${value.toLocaleTimeString('default', timeOptions)} UTC`; } -- cgit v1.2.3