Skip to content

Commit 5271c6b

Browse files
committed
fix
1 parent 139ea79 commit 5271c6b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

frontend/src/components/schedule-event-detail/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { LiveIcon } from "@python-italia/pycon-styleguide/icons";
1313
import { SnakeWithPopcorn } from "@python-italia/pycon-styleguide/illustrations";
1414
import { isAfter, isBefore, parseISO } from "date-fns";
15-
import { zonedTimeToUtc } from "date-fns-tz";
15+
import { fromZonedTime } from "date-fns-tz";
1616
import type React from "react";
1717
import { FormattedMessage } from "react-intl";
1818

@@ -53,8 +53,8 @@ type Props = {
5353

5454
const isEventLive = (startTime: string, endTime: string) => {
5555
const now = new Date();
56-
const utcStart = zonedTimeToUtc(parseISO(startTime), "Europe/Rome");
57-
const utcEnd = zonedTimeToUtc(parseISO(endTime), "Europe/Rome");
56+
const utcStart = fromZonedTime(parseISO(startTime), "Europe/Rome");
57+
const utcEnd = fromZonedTime(parseISO(endTime), "Europe/Rome");
5858
return isAfter(now, utcStart) && isBefore(now, utcEnd);
5959
};
6060

frontend/src/components/schedule-view/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "@python-italia/pycon-styleguide";
99
import va from "@vercel/analytics";
1010
import { isAfter, isBefore, parseISO } from "date-fns";
11-
import { zonedTimeToUtc } from "date-fns-tz";
11+
import { fromZonedTime } from "date-fns-tz";
1212
import React, {
1313
Fragment,
1414
useCallback,
@@ -437,11 +437,11 @@ export const findLiveSlot = ({
437437
}): Slot | undefined => {
438438
const now = new Date();
439439
return slots.find((slot) => {
440-
const startHour = zonedTimeToUtc(
440+
const startHour = fromZonedTime(
441441
parseISO(`${currentDay}T${slot.hour}`),
442442
"Europe/Rome",
443443
);
444-
const endHour = zonedTimeToUtc(
444+
const endHour = fromZonedTime(
445445
parseISO(`${currentDay}T${slot.endHour}`),
446446
"Europe/Rome",
447447
);

0 commit comments

Comments
 (0)