As far as I can tell, Plotly.js uses a mix of browser and UTC time according to some internal logic and depending on whether the input is string or numeric. This is causing me all sorts of problems because users around the world need to see the data in the timezone where the sensor resides, not by whatever their alarm clock told them that morning.
I am feeding the data from Flask so I can do whatever timeshifts I need. For example, I can just tell Plotly that the data is in UTC when really it is Australia/Yancowinna, and plotly will never know. Ok, so that is the easy bit.
I can see in the source code the lines:
lib.ms2DateTime = datesModule.ms2DateTime;
lib.ms2DateTimeLocal = datesModule.ms2DateTimeLocal;
So I would setting lib.ms2DateTimeLocal equal to datesModule.ms2DateTime make the problem go away?
I see the inverse too. There is no corresponding pair dateTimeLocal2ms() vs dateTime2ms. Only the former (which is called the latter) so that one requires an internal edit to delete call to s.getTimezoneOffset().
Except plotly doesnt seem to expose those functions. So I think option “A” would be to maintain a local copy of plotly.js and make that edit. Are these the only lines I would need to change or is this timezone behaviour scattered everywhere?
For a more nuclear option “B”, how about a monkeypatch of Date? I can do that in the browser: redefine d.getHours() to d.getUTCHours(); etc.
Would that finally get me to always be in UTC?
Is there an option C? Some kinda of global parameter to tell Plotly to never use browser time?