File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed
Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -221,9 +221,19 @@ export const getCalendarHeadingLabel = (
221221
222222export const mapToBackend = ( s : Schema_SelectedDates ) => {
223223 if ( s . isAllDay ) {
224+ const startDate = dayjs ( s . startDate ) . format ( YEAR_MONTH_DAY_FORMAT ) ;
225+ const endDate = dayjs ( s . endDate ) . format ( YEAR_MONTH_DAY_FORMAT ) ;
226+
227+ if ( startDate === endDate ) {
228+ return {
229+ startDate,
230+ endDate : dayjs ( endDate ) . add ( 1 , "day" ) . format ( YEAR_MONTH_DAY_FORMAT ) ,
231+ } ;
232+ }
233+
224234 return {
225- startDate : dayjs ( s . startDate ) . format ( YEAR_MONTH_DAY_FORMAT ) ,
226- endDate : dayjs ( s . endDate ) . format ( YEAR_MONTH_DAY_FORMAT ) ,
235+ startDate,
236+ endDate,
227237 } ;
228238 }
229239
Original file line number Diff line number Diff line change @@ -98,14 +98,18 @@ export const EventDateUtils = {
9898 ) => {
9999 return events . filter ( ( event ) => {
100100 if ( event . isAllDay ) {
101- const belongsInRange =
102- dayjs ( event . startDate ) . isSameOrAfter ( startDate ) ||
103- dayjs ( event . endDate ) . isSameOrBefore ( endDate ) ||
104- // is between start and end date
105- ( dayjs ( startDate ) . isBetween ( event . startDate , event . endDate ) &&
106- dayjs ( endDate ) . isBetween ( event . startDate , event . endDate ) ) ;
101+ // For all-day events with exclusive end dates (e.g., Mon event: start="2025-09-08", end="2025-09-09")
102+ // Check if the event overlaps with the requested date range
103+ const eventStart = dayjs ( event . startDate ) ;
104+ const eventEnd = dayjs ( event . endDate ) ; // This is exclusive, so the event ends at the very start of the end date
105+ const rangeStart = dayjs ( startDate ) ;
106+ const rangeEnd = dayjs ( endDate ) ;
107107
108- return belongsInRange ;
108+ // Event overlaps if: event starts before range ends AND event ends after range starts
109+ const overlaps =
110+ eventStart . isBefore ( rangeEnd ) && eventEnd . isAfter ( rangeStart ) ;
111+
112+ return overlaps ;
109113 }
110114
111115 return (
You canāt perform that action at this time.
0 commit comments