You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Within reports/daily stats tonight:
At night I seem to be getting a day-of-the-week response based in UTC or where the server is hosted, but I'm getting a calendar-day response from my local time.
I see for example "Tuesday, 1/29/2024" -- Tuesday belonging to the latest date in the server location, and 1/29 belonging to my location. 1/29/2024 is a Monday.
To Reproduce
I suspect this problem will look different in the morning when the dates appear to be the same.
Expected behavior
There is a mismatch in day-of-week reporting and calendar-date reporting when the remote date is different from the local date.
Screenshots
Will attach from my phone in a comment.
Your setup information
Nightscout 15.0.2
Sharebridge
Additional context
I believe the problem is in /lib/report_plugins/utils.js, with some unnecessarily complex day-of-week hardcoded that will also break translations. The handling for the day-of-the-week is different than the handling for the localized date, but both can be handled in the same way.
However, I am getting readings for the actual Tuesday, 1/30/2024, here in my living room where it's Monday, 1/29/2024. Any fix would need some testing.
That said, however, if a localized date string is what makes sense here, then the answer might be to rip out the hard-coded day-of-week lookup array and let toLocaleDateString handle the full translation.
(for testing: var date = new Date() )
ret = date.toDate().toLocaleDateString({weekday: "long", month: "numeric", day: "numeric", year: "numeric"});
At the moment there are 0 readings for "Wednesday 1/30/2024", which again does not exist; 116 readings for "Tuesday 1/29/2024", and 287 for "Monday 1/28/2024". At this moment, in my local time and in GMT, it is Tuesday, 1/30/2024.
Describe the bug
Within reports/daily stats tonight:
At night I seem to be getting a day-of-the-week response based in UTC or where the server is hosted, but I'm getting a calendar-day response from my local time.
I see for example "Tuesday, 1/29/2024" -- Tuesday belonging to the latest date in the server location, and 1/29 belonging to my location. 1/29/2024 is a Monday.
To Reproduce
I suspect this problem will look different in the morning when the dates appear to be the same.
Expected behavior
There is a mismatch in day-of-week reporting and calendar-date reporting when the remote date is different from the local date.
Screenshots
Will attach from my phone in a comment.
Your setup information
Nightscout 15.0.2
Sharebridge
Additional context
I believe the problem is in
/lib/report_plugins/utils.js
, with some unnecessarily complex day-of-week hardcoded that will also break translations. The handling for the day-of-the-week is different than the handling for the localized date, but both can be handled in the same way.However, I am getting readings for the actual Tuesday, 1/30/2024, here in my living room where it's Monday, 1/29/2024. Any fix would need some testing.
That said, however, if a localized date string is what makes sense here, then the answer might be to rip out the hard-coded day-of-week lookup array and let
toLocaleDateString
handle the full translation.(for testing: var date = new Date() )
ret = date.toDate().toLocaleDateString({weekday: "long", month: "numeric", day: "numeric", year: "numeric"});
Sample runs:
date.toLocaleDateString("en-US", {weekday: "long", month: "numeric", day: "numeric", year: "numeric"})
"Monday, 1/29/2024"
date.toLocaleDateString("de-DE", {weekday: "long", month: "numeric", day: "numeric", year: "numeric"})
"Montag, 29.1.2024"
I had a little bit more information here: #8176 (comment)
The text was updated successfully, but these errors were encountered: