diff --git a/discord_verificiation/playtime-frontend/components/RecurringWindowChart.tsx b/discord_verificiation/playtime-frontend/components/RecurringWindowChart.tsx index 9842267..98b732c 100644 --- a/discord_verificiation/playtime-frontend/components/RecurringWindowChart.tsx +++ b/discord_verificiation/playtime-frontend/components/RecurringWindowChart.tsx @@ -3,6 +3,7 @@ import { useState } from 'react'; import Link from 'next/link'; import PlayerTimelineChart from './PlayerTimelineChart'; +import TimeInput24 from './TimeInput24'; import { formatMinutes, countryCodeToFlag } from '@/lib/steam'; interface RecurringPoint { @@ -181,22 +182,12 @@ export default function RecurringWindowChart() { - From - setStartTime(e.target.value)} - className="bg-base border border-base-border rounded px-2 py-1 text-ink text-sm font-mono" - /> + From (24h) + - Until - setEndTime(e.target.value)} - className="bg-base border border-base-border rounded px-2 py-1 text-ink text-sm font-mono" - /> + Until (24h) + Since diff --git a/discord_verificiation/playtime-frontend/components/TimeInput24.tsx b/discord_verificiation/playtime-frontend/components/TimeInput24.tsx new file mode 100644 index 0000000..aa64eb7 --- /dev/null +++ b/discord_verificiation/playtime-frontend/components/TimeInput24.tsx @@ -0,0 +1,51 @@ +'use client'; + +// A deliberately unambiguous 24-hour time picker. Native +// displays 12-hour AM/PM or 24-hour format depending on the *browser's own +// locale settings* — completely outside this app's control — which makes +// "12:00 PM" (noon) easy to misread as "end of day" on a 12-hour-locale +// browser. Two plain dropdowns sidestep that entirely: every +// visitor sees the same unambiguous HH:MM regardless of their locale. + +const HOURS = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, '0')); +const MINUTES = ['00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55']; + +export default function TimeInput24({ + value, + onChange, +}: { + value: string; // "HH:MM", 24-hour + onChange: (value: string) => void; +}) { + const [hh, mm] = value.split(':'); + + return ( + + onChange(`${e.target.value}:${mm}`)} + className="bg-transparent text-ink text-sm font-mono focus:outline-none" + aria-label="Hour (24-hour)" + > + {HOURS.map((h) => ( + + {h} + + ))} + + : + onChange(`${hh}:${e.target.value}`)} + className="bg-transparent text-ink text-sm font-mono focus:outline-none" + aria-label="Minute" + > + {MINUTES.map((m) => ( + + {m} + + ))} + + + ); +}