const TIME_FORMAT = 'h:mm:ss A' ; import { timezone } from '@frogpond/constants' ; import moment from 'moment-timezone' ; import type { Moment } from 'moment-timezone' ; const parseTime = ( now , time ) : null | Moment => { let m = moment . tz ( time , TIME_FORMAT , true , timezone ( ) ) ; m . dayOfYear ( now . dayOfYear ( ) ) ; if ( m . diff ( now ) < 0 ) { m . add ( 1 , 'days' ) ; } return m ; } ; export const getTimeRemaining = ( now , time ) => { return parseTime ( now , time ) ?. fromNow ( ) ; } ;