refactor(arc): calendar date logic unification - #232
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the Abstract Resource Calendar (ARC) feature to consolidate date/day handling by removing bespoke date utilities and switching more logic to date-fns formatting and Date objects.
Changes:
- Removed multiple ARC date utility helpers (
serializeDateDay, month helpers, date-object formatting, time formatting). - Updated calendar mappers and calendar UI to generate and consume day keys via
date-fnsformatting. - Updated modal header and related unit tests to display localized, formatted dates.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/features/abstract-resource-calendar/utils/serialize-date-day.ts | Removed date-day serialization helper. |
| src/features/abstract-resource-calendar/utils/get-month-by-number-and-year.ts | Removed month-by-number/year helper. |
| src/features/abstract-resource-calendar/utils/get-month-by-date.ts | Removed month-by-date helper. |
| src/features/abstract-resource-calendar/utils/get-modal-header.ts | Formats clicked day into a localized “dd MMMM yyyy” modal header. |
| src/features/abstract-resource-calendar/utils/get-modal-header.test.ts | Updates expectations around the modal header’s date formatting. |
| src/features/abstract-resource-calendar/utils/get-events-for-day.ts | Changes API to accept Date and derives day key via date-fns. |
| src/features/abstract-resource-calendar/utils/format-time.ts | Removed calendar event time formatting helper. |
| src/features/abstract-resource-calendar/utils/format-date-object.ts | Removed date-object → day-key helper. |
| src/features/abstract-resource-calendar/utils/find-existing-day-swap.ts | Reworks day-key generation for looking up semester day swaps. |
| src/features/abstract-resource-calendar/utils/event-calendar-mapper.tsx | Updates event→day mapping to use date-fns for day keys. |
| src/features/abstract-resource-calendar/utils/academic-calendar-mapper.tsx | Updates semester holiday/day-swap mapping to use date-fns day keys. |
| src/features/abstract-resource-calendar/types/internal.ts | Removes DateObject and keeps calendar internal types focused on day keys. |
| src/features/abstract-resource-calendar/components/arc-internal.tsx | Refactors calendar grid generation and day selection around Date objects and date-fns. |
| src/features/abstract-resource-calendar/components/arc-holiday-card.tsx | Displays formatted holiday date ranges (localized). |
| src/features/abstract-resource-calendar/components/arc-event-card.tsx | Replaces old time formatter with direct date-fns formatting. |
| src/features/abstract-resource-calendar/components/arc-day-button.tsx | Refactors day button props to take a Date rather than a custom date object. |
| src/features/abstract-resource-calendar/components/arc-academic-semester-card.tsx | Switches semester date display to date-fns formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kguzek
requested changes
Feb 18, 2026
GTR1701
force-pushed
the
refactor/calendar-date-unification
branch
from
February 19, 2026 10:55
215cc9f to
13bd8a0
Compare
GTR1701
force-pushed
the
refactor/calendar-date-unification
branch
from
March 25, 2026 12:57
c823863 to
e5bdaf7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
src/features/abstract-resource-calendar/utils/get-modal-header.test.ts:25
clickedDayis expected to be the day key (e.g. "2024-03-15") coming from calendar clicks, but the test now passes a localized formatted string. SincegetModalHeaderformatsclickedDayinternally, this makes the test environment-dependent and may fail parsing. Pass the raw day key intogetModalHeaderand assert against the formatted output separately.
const clickedDay = format(new Date("2024-03-15"), "dd MMMM yyyy", {
locale: pl,
});
it("should return resource name with date for resource without relations", () => {
const result = getModalHeader(Resource.CalendarEvents, clickedDay);
expect(result).toBe(`Wydarzenia kalendarzowe ${clickedDay}`);
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.