Skip to content
Merged
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
24 changes: 24 additions & 0 deletions src/lib/constants/weekday.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,27 @@ export const dayMap: Record<Weekday, string> = {
SATURDAY: '토요일',
SUNDAY: '일요일',
};

/**
* @description
* - 상수로 정의된 요일을 enum으로 정의
* - 날짜간 대소 비교에 사용
* @example
* ```ts
* const mondayString: Weekday = "MONDAY"
* const fridayString: Weekday = "FRIDAY"
* const mondayEnum: WeekdayEnum = WeekdayEnum[mondayString];
* const fridayEnum: WeekdayEnum = WeekdayEnum[fridayString];
* console.log(mondayEnum > fridayEnum); // false
* ```
*
*/
export enum WeekdayEnum {
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY,
SUNDAY,
}
Loading