massucattoj commented on code in PR #37064:
URL: https://github.com/apache/superset/pull/37064#discussion_r2684014127
##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/utils.ts:
##########
@@ -26,5 +26,11 @@ export const getFormattedUTCTime = (
) => {
const date = new Date(ts);
const offset = date.getTimezoneOffset() * 60 * 1000;
- return getTimeFormatter(timeFormat)(date.getTime() - offset);
+ return getTimeFormatter(timeFormat)(date.getTime() + offset);
+};
+
+export const convertUTCTimestampToLocal = (utcTimestamp: number): number => {
+ const date = new Date(utcTimestamp);
+ const offsetMs = date.getTimezoneOffset() * 60 * 1000;
+ return utcTimestamp + offsetMs;
Review Comment:
The vendor library interprets timestamps coming from the backend as local
time zone instead of UTC. So this little tricky is necessay in order to make it
work. Since it's an external library this should be the way to fix the issue.
--
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]