Skip to content

Commit

Permalink
Add sorting for opening hours
Browse files Browse the repository at this point in the history
sorting to ensure that the opening hours are displayed in the correct chronological order by `start_time` :
- Åbent 06:00 - 22:00
- Åbent 10:00 - 17:00
- Åbent 12:00 - 13:00
  • Loading branch information
kasperbirch1 committed May 31, 2024
1 parent 672fcb7 commit fad2e73
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/apps/opening-hours/OpeningHoursHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ export const groupOpeningHoursByWeekday = (
const daysWithOpeningHours: GroupedOpeningHours = allDays.map((day) => {
return {
dateTime: day,
openingHourEntries: openingHours.filter((individualOpeningHour) =>
dayjs(individualOpeningHour.date).isSame(day, "day")
)
openingHourEntries: openingHours
.filter((individualOpeningHour) =>
dayjs(individualOpeningHour.date).isSame(day, "day")
)
.sort((a, b) => a.start_time.localeCompare(b.start_time))
};
});

Expand Down

0 comments on commit fad2e73

Please sign in to comment.