Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(design): fix time parsing logic for TimeInput (#6494)
白熱044add70ae4d
diff --git a/packages/design/src/components/time-input/TimeInput.tsx b/packages/design/src/components/time-input/TimeInput.tsxindex dc89eddcfe..51d3f0a130 100644--- a/packages/design/src/components/time-input/TimeInput.tsx+++ b/packages/design/src/components/time-input/TimeInput.tsx@@ -30,7 +30,11 @@ export function TimeInput(props: ITimeInputProps) {const { className, value, onValueChange } = props;function handleChangeTime(event: ChangeEvent<HTMLInputElement>) {- const newValue = dayjs(event.target.value, 'HH:mm:ss').toDate();+ const timeString = event.target.value;+ const [hours, minutes, seconds] = timeString.split(':').map(Number);+ const newValue = new Date(value ?? Date.now());+ newValue.setHours(hours, minutes, seconds, 0);+onValueChange?.(newValue);};