My graph (a complex JS library I'd prefer not to modify) requires Javascript timestamps that are in local time (the graph doesn't adjust for timezone and DST so it must be done on database side.) for drawing the time axis - the source data is pretty much untouchable.
I use the same data to display a tooltip, which is pretty much "cook my own", to display precise values of data points.
Now comes the problem:
- If I use
Date(x).toUTCString()
I'm getting the correct value displayed according to international locales - English month and day name etc. - If I use
Date(x).toLocaleString()
I'm getting the correct formatting but the date displayed is off by my timezone+DST offset; it's been already added on the server side and now the function adds it again.
Date(x).toString
and Date(x).toGMTString
weren't helpful either.
How do I get locale-formatted date that is not timezone-adjusted?