Skip to content

Commit

Permalink
Merge pull request #924 from cultuurnet/feature/III-6257
Browse files Browse the repository at this point in the history
III-6257-Sort the days of the opening hours
  • Loading branch information
vhande authored Oct 14, 2024
2 parents feb0e77 + b9e40a2 commit 6b4a633
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/constants/DaysOfWeek.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Values } from '@/types/Values';

const DaysOfWeek = {
MONDAY: 'monday',
TUESDAY: 'tuesday',
WEDNESDAY: 'wednesday',
THURSDAY: 'thursday',
FRIDAY: 'friday',
SATURDAY: 'saturday',
SUNDAY: 'sunday',
} as const;
const DaysOfWeek = [
'monday',
'tuesday',
'wednesday',
'thursday',
'friday',
'saturday',
'sunday',
] as const;

type DayOfWeek = Values<typeof DaysOfWeek>;
type DayOfWeek = (typeof DaysOfWeek)[number];

export { DaysOfWeek };
export type { DayOfWeek };
3 changes: 3 additions & 0 deletions src/pages/steps/CalendarStep/CalendarOpeninghoursModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ const CalendarOpeninghoursModal = ({
openingHours.map((openingHour) => {
if (openingHour.id === idToChange && checked) {
openingHour.dayOfWeek.push(dayOfWeek);
openingHour.dayOfWeek.sort((a, b) => {
return DaysOfWeek.indexOf(a) - DaysOfWeek.indexOf(b);
});
}
if (
openingHour.id === idToChange &&
Expand Down

0 comments on commit 6b4a633

Please sign in to comment.