Skip to content

Commit

Permalink
opening hours fix (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueHorn07 authored Jul 16, 2024
1 parent 3250a26 commit e843a3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lib/opening_hours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ export const KoreanWeekday: any = {
Everyday: '매일',
};

export const KoreanToEnglishMap: any = {
월요일: 'Monday',
화요일: 'Tuesday',
수요일: 'Wednesday',
목요일: 'Thursday',
금요일: 'Friday',
토요일: 'Saturday',
일요일: 'Sunday',
};

export function isOnOpeningHours(
opening_hours: string,
weekday: string, // Monday
Expand All @@ -20,6 +30,10 @@ export function isOnOpeningHours(
if (openingHour['Everyday']) {
weekday = 'Everyday';
}

if (KoreanToEnglishMap[weekday]) {
weekday = KoreanToEnglishMap[weekday];
}
const hours = openingHour[weekday].split(',');

for (const hour of hours) {
Expand Down
2 changes: 1 addition & 1 deletion pages/reservation/place/[region]/[placeName]/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const PlaceReservationCreatePage: React.FunctionComponent<{

const isPossible = isOnOpeningHours(
placeInfo.opening_hours,
date.format('dddd'), // Monday
date.format('dddd'), // 월요일
startTime.format('HH:mm'),
endTime.format('HH:mm'),
);
Expand Down

0 comments on commit e843a3c

Please sign in to comment.