import { useState } from "react"; import { dateToDigital, digitalToDate } from "../utils"; interface DigitalClockProps { currentTime: Date; onTimeChange: (time: Date) => void; disabled?: boolean; } export function DigitalClock({ currentTime, onTimeChange, disabled = false, }: DigitalClockProps) { const [inputValue, setInputValue] = useState(dateToDigital(currentTime)); const handleChange = (e: React.ChangeEvent) => { const value = e.target.value; setInputValue(value); const date = digitalToDate(value); if (!isNaN(date.getTime())) { onTimeChange(date); } }; return (
); }