rusackas commented on code in PR #42308:
URL: https://github.com/apache/superset/pull/42308#discussion_r3651262778
##########
superset-frontend/src/explore/components/controls/DateFilterControl/utils/dateParser.ts:
##########
@@ -40,11 +40,18 @@ export const ISO8601_AND_CONSTANT = RegExp(
const SPECIFIC_MODE = ['specific', 'today', 'now'];
export const dttmToDayjs = (dttm: string): Dayjs => {
+ // "now"/"today" are later formatted (see dttmToString) into a naive
+ // "YYYY-MM-DDTHH:mm:ss" string with no UTC offset, and that string is
+ // re-parsed elsewhere as local time (the `extendedDayjs(dttm)` fallback
+ // below). Resolving these constants in UTC rather than local time would
+ // make that round trip drift by the browser's UTC offset, which is what
+ // caused the "Now" anchor to display and query the wrong wall-clock time
+ // for users outside UTC.
if (dttm === 'now') {
- return extendedDayjs().utc().startOf('second');
+ return extendedDayjs().startOf('second');
Review Comment:
Added a note to UPDATING.md flagging the change. Gating it to charts saved
after this lands isn't really doable though, "now"/"today" are stored as the
literal strings and resolved fresh every time the chart runs, there's no saved
timestamp to version against. So it's really just a bug fix landing for
everyone at once, hand-wavy UPDATING.md note is probably the best we can do
here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]