Skip to content

Commit 6667a82

Browse files
committed
Compute local time based on utc time.
1 parent 12a8b7e commit 6667a82

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pyrene/src/components/TimeRangeSelector/TimeRangeNavigationBar/TimeRangeNavigationBar.jsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33

44
import { differenceInMinutes, getTime, format } from 'date-fns';
5-
import { zonedTimeToUtc } from 'date-fns-tz';
5+
import { utcToZonedTime } from 'date-fns-tz';
66

77

88
import ArrowSelector from './ArrowSelector/ArrowSelector';
@@ -27,10 +27,9 @@ const TimeRangeNavigationBar = (props) => {
2727
);
2828
};
2929

30-
/* eslint-disable-next-line react/display-name */
3130
TimeRangeNavigationBar.renderCurrentTimeRange = (from, to, timezone) => {
32-
const localFrom = getTime(zonedTimeToUtc(new Date(from), timezone));
33-
const localTo = getTime(zonedTimeToUtc(new Date(to), timezone));
31+
const localFrom = getTime(utcToZonedTime(new Date(from), timezone));
32+
const localTo = getTime(utcToZonedTime(new Date(to), timezone));
3433
const pattern = 'dd.MM.yyyy, HH:mm';
3534

3635
return `${format(localFrom, pattern)} - ${format(localTo, pattern)}`;

0 commit comments

Comments
 (0)