dosubot[bot] commented on issue #30627:
URL: https://github.com/apache/superset/issues/30627#issuecomment-2839432739

   <!-- Answer -->
   To resolve the issue of the "Now" button using UTC instead of the local 
timezone, you need to ensure that the `useLocalTime` parameter is set to `true` 
when calling the `createUtils` function in the `d3Time.ts` file. This will 
switch the time intervals from UTC to local time.
   
   Here's the relevant code snippet:
   
   ```ts
   function createUtils(useLocalTime = false) {
     // ... other code ...
     if (useLocalTime) {
       // Use local time intervals
       floorSecond = timeSecond;
       floorMinute = timeMinute;
       floorHour = timeHour;
       floorDay = timeDay;
       floorWeek = timeWeek;
       floorWeekStartOnSunday = timeSunday;
       floorWeekStartOnMonday = timeMonday;
       floorWeekStartOnTuesday = timeTuesday;
       floorWeekStartOnWednesday = timeWednesday;
       floorWeekStartOnThursday = timeThursday;
       floorWeekStartOnFriday = timeFriday;
       floorWeekStartOnSaturday = timeSaturday;
       floorMonth = timeMonth;
       floorYear = timeYear;
     } else {
       // Use UTC time intervals
       floorSecond = utcSecond;
       floorMinute = utcMinute;
       floorHour = utcHour;
       floorDay = utcDay;
       floorWeek = utcWeek;
       floorWeekStartOnSunday = utcSunday;
       floorWeekStartOnMonday = utcMonday;
       floorWeekStartOnTuesday = utcTuesday;
       floorWeekStartOnWednesday = utcWednesday;
       floorWeekStartOnThursday = utcThursday;
       floorWeekStartOnFriday = utcFriday;
       floorWeekStartOnSaturday = utcSaturday;
       floorMonth = utcMonth;
       floorYear = utcYear;
     }
   }
   ```
   
   Ensure that when you call `createUtils`, you pass `true` for `useLocalTime`:
   
   ```ts
   const timeUtils = createUtils(true);
   ```
   
   This change should make the "Now" button use the local timezone instead of 
UTC 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/time-format/utils/d3Time.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/06519c7d-1e67-4f84-a1e3-1e73875a0fe4?feedback_type=other)</sup>
   


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