-
Notifications
You must be signed in to change notification settings - Fork 67
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
fix: ics calendar export dates #535
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Requested some minor changes in addition that this requires further testing.
'2028-07-04', // Independence Day holiday | ||
], | ||
}, | ||
} as const satisfies Partial<Record<SemesterIdentifier, AcademicCalendarSemester>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; | ||
type Year = `20${Digit}${Digit}`; | ||
type Month = `0${Exclude<Digit, 0>}` | `1${'0' | '1' | '2'}`; | ||
type Day = `0${Exclude<Digit, 0>}` | `${1 | 2}${Digit}` | '30' | '31'; | ||
type DateStr = `${Year}-${Month}-${Day}`; | ||
type SemesterDigit = 2 | 6 | 9; | ||
type SemesterIdentifier = `20${Digit}${Digit}${SemesterDigit}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of Template Literal Types
Now will export classes based on the academic calendar. Allows for skipping holidays and multi-day breaks. Accounts for semesters by using the semester info on the course itself, so it's legal to have a schedule with multiple semesters (though, that should be prevented in general, but that will be a separate PR).
Drawbacks: Doesn't support winter terms or any of the various summer terms, except it interprets all summer courses as full-term summer courses.
This change is