File tree Expand file tree Collapse file tree
components/Activity/Hackathon Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ type TextLike = TableCellValue | NamedLike | null | undefined;
3838type TextListLike = TextLike | TextLike [ ] ;
3939
4040const textOf = ( value : TextLike ) => {
41- if ( ! value ) return '' ;
41+ if ( value === null || value === undefined ) return '' ;
4242
4343 if ( typeof value === 'object' && ! Array . isArray ( value ) ) {
4444 const {
@@ -140,13 +140,15 @@ export const resolveCountdownState = <T extends CountdownWindow>(
140140 return Number . isFinite ( started ) && Number . isFinite ( ended ) && referenceTime <= ended ;
141141 } ) ;
142142 const nextStartedAt = timeOf ( nextItem ?. startedAt ) ;
143+ const nextCountdownTarget =
144+ Number . isFinite ( nextStartedAt ) && nextStartedAt > referenceTime
145+ ? nextItem ?. startedAt
146+ : nextItem ?. endedAt ;
147+ const fallbackCountdownTarget = timeOf ( startTime ) > referenceTime ? startTime : endTime ;
143148 const countdownTo =
144- ( Number . isFinite ( nextStartedAt ) && nextStartedAt > referenceTime
145- ? ( nextItem ?. startedAt as string | undefined )
146- : ( nextItem ?. endedAt as string | undefined ) ) ||
147- ( timeOf ( startTime ) > referenceTime
148- ? ( startTime as string | undefined )
149- : ( endTime as string | undefined ) ) ;
149+ firstTextOf ( nextCountdownTarget as TextListLike ) ||
150+ firstTextOf ( fallbackCountdownTarget as TextListLike ) ||
151+ undefined ;
150152
151153 return { nextItem, countdownTo } ;
152154} ;
You can’t perform that action at this time.
0 commit comments