feat(DateTimeFields): implement free typing time input with dropdown

- Replace default TimePicker field with custom EditableTimeField
- Allow free typing with multiple formats (HH:mm, HHmm, H, etc.)
- Show dropdown on click while maintaining typing capability
- Center-align time input text
This commit is contained in:
lenhanphung
2025-12-10 11:47:05 +07:00
committed by Benoit TELLIER
parent 12776d36a4
commit 627e9bf44b
13 changed files with 605 additions and 223 deletions
+19 -1
View File
@@ -181,6 +181,19 @@ export default function EventFormFields({
onHasEndDateChangedChange?.(hasEndDateChanged);
}, [hasEndDateChanged, onHasEndDateChangedChange]);
// Reset hasEndDateChanged when startDate === endDate in normal mode
React.useEffect(() => {
if (
!showMore &&
hasEndDateChanged &&
startDate &&
endDate &&
startDate === endDate
) {
setHasEndDateChanged(false);
}
}, [showMore, hasEndDateChanged, startDate, endDate]);
// Use all-day toggle hook
const { handleAllDayToggle } = useAllDayToggle({
allday,
@@ -449,7 +462,12 @@ export default function EventFormFields({
onStartTimeChange={handleStartTimeChange}
onEndDateChange={handleEndDateChange}
onEndTimeChange={handleEndTimeChange}
showEndDate={showMore || allday}
showEndDate={
showMore ||
allday ||
(hasEndDateChanged && startDate !== endDate) ||
(!showMore && !allday && startDate !== endDate)
}
onToggleEndDate={() => {}}
/>
</FieldWithLabel>