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:
committed by
Benoit TELLIER
parent
12776d36a4
commit
627e9bf44b
@@ -758,16 +758,17 @@ function EventPopover({
|
||||
} else {
|
||||
newEvent.start = convertFormDateTimeToISO(start, timezone);
|
||||
if (end) {
|
||||
// In normal mode, only override end date when the end date field is not shown
|
||||
if (!showMore && !hasEndDateChanged) {
|
||||
const startDateOnly = (start || "").split("T")[0];
|
||||
// In normal mode, only override end date when the end date field is not shown and end date is same as start date
|
||||
const startDateOnly = (start || "").split("T")[0];
|
||||
const endDateOnly = (end || "").split("T")[0];
|
||||
if (!showMore && !hasEndDateChanged && startDateOnly === endDateOnly) {
|
||||
const endTimeOnly = end.includes("T")
|
||||
? end.split("T")[1]?.slice(0, 5) || "00:00"
|
||||
: "00:00";
|
||||
const endDateTime = `${startDateOnly}T${endTimeOnly}`;
|
||||
newEvent.end = convertFormDateTimeToISO(endDateTime, timezone);
|
||||
} else {
|
||||
// Extended mode or end date explicitly shown in normal mode: use actual end datetime
|
||||
// Extended mode or end date explicitly shown in normal mode or end date differs from start date: use actual end datetime
|
||||
newEvent.end = convertFormDateTimeToISO(end, timezone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,16 +562,17 @@ function EventUpdateModal({
|
||||
} else {
|
||||
// For timed events
|
||||
startDate = convertFormDateTimeToISO(start, timezone);
|
||||
// In normal mode, only override end date when the end date field is not shown
|
||||
if (!showMore && !hasEndDateChanged) {
|
||||
const startDateOnly = (start || "").split("T")[0];
|
||||
// In normal mode, only override end date when the end date field is not shown and end date is same as start date
|
||||
const startDateOnly = (start || "").split("T")[0];
|
||||
const endDateOnly = (end || "").split("T")[0];
|
||||
if (!showMore && !hasEndDateChanged && startDateOnly === endDateOnly) {
|
||||
const endTimeOnly = end.includes("T")
|
||||
? end.split("T")[1]?.slice(0, 5) || "00:00"
|
||||
: "00:00";
|
||||
const endDateTime = `${startDateOnly}T${endTimeOnly}`;
|
||||
endDate = convertFormDateTimeToISO(endDateTime, timezone);
|
||||
} else {
|
||||
// Extended mode: use actual end datetime
|
||||
// Extended mode or end date explicitly shown in normal mode or end date differs from start date: use actual end datetime
|
||||
endDate = convertFormDateTimeToISO(end, timezone);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user