-
Notifications
You must be signed in to change notification settings - Fork 71.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bgclock 24h fix #4162
bgclock 24h fix #4162
Conversation
Dev update
Dev sync
Fix for clock showing "24:xx" in 24-hour mode.
@@ -124,7 +124,13 @@ | |||
// Generate and insert the clock. | |||
var timeDivisor = (window.serverSettings.settings.timeFormat) ? window.serverSettings.settings.timeFormat : 12; | |||
var today = new Date(), | |||
h = today.getHours() % timeDivisor || timeDivisor, | |||
h = today.getHours() % timeDivisor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to do the time formatting in the same way within Nightscout and use a formatting function instead of doing the formatting inline.
In the frontend we use a rather outdated version of the d3 library, see
cgm-remote-monitor/lib/client/index.js
Line 509 in 7c272ec
.text(formatTime(nowDate, true)) |
I don't mind switching to
moment
javascript for both basic viewing of the time and the bgclock function. See e.g.
http://momentjs.com/docs/#/parsing/string-format/
https://stackoverflow.com/questions/12970284/moment-js-24h-format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'm going to need guidance on how to properly include a library like that; not clear on the broad implications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get this one into .11 and then do the clock rebuilds alongside the other view changes we've got slated for .12?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clock refactoring should be part of 0.12, in order to make it work similar to the normal frontend
Merging for now for 0.11. bigger clock refactors should be done in Nightscout 0.12 |
Clock display code was generating "24:xx" instead of "00:xx". Fixed, and also ensured 12-hour time would still do "12:xx".