@@ -63,6 +63,7 @@ import {
6363 normalizeAgendaType ,
6464 previewText ,
6565 textListOf ,
66+ timeOf ,
6667} from '../../components/Activity/Hackathon/utility' ;
6768
6869interface HackathonDetailProps {
@@ -126,10 +127,16 @@ const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackatho
126127 const { forms } = databaseSchema ;
127128 const formMap = ( forms || { } ) as Partial < Record < FormGroupKey , TableFormView [ ] > > ;
128129 const summaryText = textListOf ( summary ) . join ( ' · ' ) || firstTextOf ( summary ) ;
129- const agendaItems = [ ...agenda ] . sort (
130- ( { startedAt : left } , { startedAt : right } ) =>
131- new Date ( ( left as string ) || 0 ) . getTime ( ) - new Date ( ( right as string ) || 0 ) . getTime ( ) ,
132- ) ;
130+ const agendaItems = [ ...agenda ] . sort ( ( { startedAt : left } , { startedAt : right } ) => {
131+ const leftTime = timeOf ( left ) ;
132+ const rightTime = timeOf ( right ) ;
133+
134+ if ( ! Number . isFinite ( leftTime ) && ! Number . isFinite ( rightTime ) ) return 0 ;
135+ if ( ! Number . isFinite ( leftTime ) ) return 1 ;
136+ if ( ! Number . isFinite ( rightTime ) ) return - 1 ;
137+
138+ return leftTime - rightTime ;
139+ } ) ;
133140 const hostTags = ( host as string [ ] | undefined ) ?. slice ( 0 , 2 ) || [ ] ;
134141 const eventRange = formatPeriod ( startTime , endTime ) ;
135142 const locationText = ( location as TableCellLocation | undefined ) ?. full_address || '-' ;
0 commit comments