mistercrunch commented on code in PR #42308:
URL: https://github.com/apache/superset/pull/42308#discussion_r3647721531


##########
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:
   This is "more right", but it's also a change in behavior ... wondering how 
many dashboards there are out there that already compensate for the current 
behavior in some way. 
   
   Question is how to handle the change in behavior?
   - hand wavy in UPDATING.md?
   - only apply to charts saved after this change? -> tech-debty, might prevent 
desired fixes, ...



-- 
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]

Reply via email to