Skip to content

Commit

Permalink
refactor: gapsService (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoamGaash authored Oct 11, 2023
1 parent 7dcb1d3 commit 68e1044
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/api/gapsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ type RawGapsList = {
actual_start_time: string
gtfs_ride_id?: number
}[]
export function parseTime(time: 'null'): null
export function parseTime(time: Exclude<string, 'null'>): Moment

export const parseTime = (time: string): Moment | null => {
export function parseTime(time: string): Moment | null {
const utcMoment: Moment = moment.utc(time).tz('Asia/Jerusalem')
if (!utcMoment.isValid()) {
if (time !== 'null' && utcMoment.isValid()) {
return utcMoment
} else {
return null
}
return utcMoment
}

const USE_API = true
Expand Down

0 comments on commit 68e1044

Please sign in to comment.