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
Creating new date object without the "Z" at the end is a valid way to create date from local time zone:
Here is an exemple from the doc you mention:
Local time
All other formats (including the above date-time form of the ISO format when the time zone offset is absent) are interpreted as local time. Notice how the components in the input string don't completely match those in the output ISO string.
console.log(new Date('2010-10-10T02:10').toISOString())
// Output (IST): "2010-10-09T20:40:00.000Z"
// Output (PDT): "2010-10-10T09:10:00.000Z"
Various components can be omitted, so the following are all valid:
Date-only form: YYYY, YYYY-MM, YYYY-MM-DD
Date-time form: one of the above date-only forms, followed by T, followed by HH:mm, HH:mm:ss, or HH:mm:ss.sss. Each combination can be followed by a time zone offset.
For example, "2011-10-10" (date-only form), "2011-10-10T14:48:00" (date-time form), or "2011-10-10T14:48:00.000+09:00" (date-time form with milliseconds and time zone) are all valid date time strings.
If you prefer, new Date("2020-03-05T00:00:00.000") is equal to new Date(2020, 2, 5).
Moreover, as i explain in the bug, you can repro this issue in the react-charting demo website in the section "LineChart custom date axis locale" when you access the website in a local time zone different from UTC: https://developer.microsoft.com/en-us/fluentui#/controls/web/linechart
For those reason, I'm reopening the issue.
Feel free to ask me more info if you need to.
The text was updated successfully, but these errors were encountered:
Gabnight
changed the title
Hello @AtishayMsft
[Bug]: Charting: customDateTimeFormatter and timeFormatLocale does not display the correct date for x axis (duplicate from comment)
May 6, 2024
Hello @AtishayMsft
Creating new date object without the "Z" at the end is a valid way to create date from local time zone:
Here is an exemple from the doc you mention:
From MDN (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format):
If you prefer, new Date("2020-03-05T00:00:00.000") is equal to new Date(2020, 2, 5).
Moreover, as i explain in the bug, you can repro this issue in the react-charting demo website in the section "LineChart custom date axis locale" when you access the website in a local time zone different from UTC:
https://developer.microsoft.com/en-us/fluentui#/controls/web/linechart
For those reason, I'm reopening the issue.
Feel free to ask me more info if you need to.
Originally posted by @Gabnight in #31269 (comment)
The text was updated successfully, but these errors were encountered: