Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opening hours fix #103

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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