File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -74,18 +74,19 @@ export default function sortEvents(events: EventClass[], config) {
7474 return timeDiffA - timeDiffB ;
7575 }
7676 } ) ;
77+ // Move finished events to the bottom
78+ sortedEvents . sort ( ( a , b ) => {
79+ if ( a . isFinished !== b . isFinished ) {
80+ return a . isFinished ? 1 : - 1 ;
81+ }
82+ // If both events are finished, sort them by their endDateTime in ascending order.
83+ if ( a . isFinished ) {
84+ return dayjs ( a . endDateTime ) . isBefore ( b . endDateTime ) ? - 1 : 1 ;
85+ }
86+ return 0 ;
87+ } ) ;
7788 }
78- // Move finished events to the bottom
79- sortedEvents . sort ( ( a , b ) => {
80- if ( a . isFinished !== b . isFinished ) {
81- return a . isFinished ? 1 : - 1 ;
82- }
83- // If both events are finished, sort them by their endDateTime in ascending order.
84- if ( a . isFinished ) {
85- return dayjs ( a . endDateTime ) . isBefore ( b . endDateTime ) ? - 1 : 1 ;
86- }
87- return 0 ;
88- } ) ;
89+
8990
9091 // If config.allDayBottom is true, add the all-day events to the end of the sorted events array.
9192 if ( config . allDayBottom ) {
You can’t perform that action at this time.
0 commit comments