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 @@ -128,6 +128,12 @@ export interface CountdownWindow {
128128 endedAt ?: TableCellValue ;
129129}
130130
131+ const countdownTextOf = ( value ?: TableCellValue ) => {
132+ const time = timeOf ( value ) ;
133+
134+ return Number . isFinite ( time ) ? new Date ( time ) . toISOString ( ) : undefined ;
135+ } ;
136+
131137export const resolveCountdownState = < T extends CountdownWindow > (
132138 items : T [ ] ,
133139 referenceTime : number ,
@@ -146,10 +152,7 @@ export const resolveCountdownState = <T extends CountdownWindow>(
146152 ? nextItem ?. startedAt
147153 : nextItem ?. endedAt ;
148154 const fallbackCountdownTarget = timeOf ( startTime ) > referenceTime ? startTime : endTime ;
149- const countdownTo =
150- firstTextOf ( nextCountdownTarget as TextListLike ) ||
151- firstTextOf ( fallbackCountdownTarget as TextListLike ) ||
152- undefined ;
155+ const countdownTo = countdownTextOf ( nextCountdownTarget ) || countdownTextOf ( fallbackCountdownTarget ) ;
153156
154157 return { nextItem, countdownTo } ;
155158} ;
You can’t perform that action at this time.
0 commit comments