commit | 07b85ef34340906a551aa68c0729ab16f10e391c | [log] [tgz] |
---|---|---|
author | Derick Montague <derick.montague@ibm.com> | Fri Jul 09 20:00:35 2021 -0500 |
committer | Derick Montague <derick.montague@ibm.com> | Wed Jul 14 22:15:55 2021 +0000 |
tree | 86db7f43fe2b36779d492c30d25edbe588cc3cf5 | |
parent | 3b73cf834aaf9117d76bb0f590a076af6c28cd4e [diff] |
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 <derick.montague@ibm.com> Change-Id: I68539d9602499dcb1bde9a4b01dd7a66fbc69d1a
diff --git a/src/main.js b/src/main.js index 8c72580..8fcb808 100644 --- a/src/main.js +++ b/src/main.js
@@ -71,7 +71,7 @@ if (isUtcDisplay) { let timeOptions = { timeZone: 'UTC', - hour12: false, + hourCycle: 'h23', }; return `${value.toLocaleTimeString('default', timeOptions)} UTC`; }