Display wall-clock times in TimeGroup instead of reprojecting

formatTime runs new Date(iso).getHours() which reprojects the
timestamp through the browser's local timezone. For a flight arriving
at 06:30 in Almaty (GMT+5) a viewer in Moscow saw '04:30'. Switch the
TimeGroup component to formatLocalTime which reads the wall-clock
directly out of the offset-aware ISO string, matching the rest of the
details/timetable views.
This commit is contained in:
2026-04-18 14:00:03 +03:00
parent 22025b3ab4
commit 4e91e9dca1
+7 -3
View File
@@ -1,5 +1,5 @@
import type { FC } from "react";
import { formatTime } from "@/shared/utils/datetime/index.js";
import { formatLocalTime } from "@/shared/utils/datetime/index.js";
import "./TimeGroup.scss";
export interface TimeGroupProps {
@@ -25,8 +25,12 @@ export const TimeGroup: FC<TimeGroupProps> = ({
dayChange,
label,
}) => {
const scheduledTime = formatTime(scheduled);
const actualTime = actual ? formatTime(actual) : undefined;
// formatLocalTime reads the wall-clock from the offset-aware ISO
// string, so a flight arriving at 06:30 in Almaty (GMT+5) reads
// 06:30 regardless of the viewer's timezone. formatTime would
// reproject through new Date() and show '04:30' in Moscow.
const scheduledTime = formatLocalTime(scheduled);
const actualTime = actual ? formatLocalTime(actual) : undefined;
const hasDelay = actualTime !== undefined && actualTime !== scheduledTime;
return (