Force ui_chart to use UTC not current locale?

Force ui_chart to use UTC not current locale? Even though the system is using UTC, and I have am sourcing timestamp from new Date() timezone UTC, ui_chart is still showing time in local context.

For example, UTC maybe 6am but chart is show 23pm which is local hour time. I am passing in the getTime() timestamp to the chart via msg.timestamp, but ui_chart seems to be ignoring it?

Do I have it right? ui_chart should honor this?

{topic:"temperature", payload:32.9, timestamp:1655620385224}

Where 1655620385224...

GMT: Sunday, June 19, 2022 6:33:05.224 AM
Your time zone: Saturday, June 18, 2022 11:33:05.224 PM [GMT-07:00]
Relative: A minute ago

Have you checked 'as UTC'

No. The way I read the documentation if I provide a timestamp, that should be honored? Regardless of the configuration specified. The timestamp is explicitly UTC.

The checkbox defines how the time should be displayed on the time axis. With the checkbox clear, the current time at the right hand side of the graph will be displayed in the local timezone, with it set the current time will be shown as UTC.

So even if you provide a timestamp, see my example above, that is UTC it is not honored, over the UI configuration, good to know. Maybe a bit surprised by this behavior, but now that I know this is the behavior, easy to deal with.

I don't understand what you mean by not honouring the timestamp. In the example you posted you gave it a timestamp of 1655620385224, which is 07:33 in your local timezone, which is the same time as 06:33 UTC.
07:33 UTC+1 and 06:33 UTC (and 1655620385224) are the same time, they are just different ways of displaying it.

1 Like

Time stamp was only UTC, generated from a UTC clock. The system has no TZ offset given its configuration. I have python, C programs that only see the given time stamp as UTC with no TZ offset. So I was a bit surprised by the Node/NR environment reporting anything in local context.

For example, the system clock...

# date
Wed 22 Jun 2022 06:03:13 PM UTC

# date +"%Z %z"
UTC +0000

So where would Node/NR get any localized context? Moreover, when I explicitly provide a UTC timestamp as a object property, per the documentation, it should be used. And I am passing in the timestamp, but somewhere somehow something is displaying localized context.

Clearly there is code logic somewhere finding some localized context, because the chart presented localized values.

But the system its-self is not configured for any localization that I can find thus far. The system logs, other views of the time presentation all present as UTC, no TZ offset.

I am currently looking at the user profiles thinking maybe the 'pi' user somehow has a localized context, which it should not. Even the user context should be UTC.

Well, users and system TZ offset are both identical and 0. So that was not it.

Of course, the browser... Geez. The TZ context is on the client side.

1 Like