Skip to content

Commit

Permalink
Add new filter for past PNOs
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Oct 30, 2024
1 parent b8d4492 commit f71d79b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export enum ExpectedArrivalPeriod {
IN_LESS_THAN_TWELVE_HOURS = 'IN_LESS_THAN_TWELVE_HOURS',
IN_LESS_THAN_ONE_DAY = 'IN_LESS_THAN_ONE_DAY',
IN_LESS_THAN_ONE_MONTH = 'IN_LESS_THAN_ONE_MONTH',
LAST_DAY = 'LAST_DAY',
CUSTOM = 'CUSTOM'
}
export const EXPECTED_ARRIVAL_PERIOD_LABEL: Record<ExpectedArrivalPeriod, string> = {
Expand All @@ -51,6 +52,7 @@ export const EXPECTED_ARRIVAL_PERIOD_LABEL: Record<ExpectedArrivalPeriod, string
IN_LESS_THAN_TWELVE_HOURS: 'Arrivée estimée dans moins de 12h',
IN_LESS_THAN_ONE_DAY: 'Arrivée estimée dans moins de 24h',
IN_LESS_THAN_ONE_MONTH: 'Arrivée estimée dans moins d’un mois',
LAST_DAY: 'Arrivée estimée ces dernières 24h',
CUSTOM: 'Période spécifique'
}
export const EXPECTED_ARRIVAL_PERIODS_AS_OPTIONS = getOptionsFromLabelledEnum(EXPECTED_ARRIVAL_PERIOD_LABEL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ function getApiFilterFromExpectedArrivalPeriod(
willArriveBefore: customDayjs.utc().add(1, 'month').toISOString()
}

case ExpectedArrivalPeriod.LAST_DAY:
return {
willArriveAfter: customDayjs.utc().subtract(1, 'day').toISOString(),
willArriveBefore: customDayjs.utc().toISOString()
}

default:
return {}
}
Expand Down

0 comments on commit f71d79b

Please sign in to comment.