Skip to content

refactor(arc): calendar date logic unification - #232

Merged
GTR1701 merged 4 commits into
mainfrom
refactor/calendar-date-unification
Mar 25, 2026
Merged

refactor(arc): calendar date logic unification#232
GTR1701 merged 4 commits into
mainfrom
refactor/calendar-date-unification

Conversation

@GTR1701

@GTR1701 GTR1701 commented Jan 31, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings January 31, 2026 13:52
@GTR1701
GTR1701 requested a review from kguzek as a code owner January 31, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-fns formatting.
  • 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.

Comment thread src/features/abstract-resource-calendar/utils/find-existing-day-swap.ts Outdated
Comment thread src/features/abstract-resource-calendar/components/arc-holiday-card.tsx Outdated
Comment thread src/features/abstract-resource-calendar/utils/academic-calendar-mapper.tsx Outdated
Comment thread src/features/abstract-resource-calendar/utils/academic-calendar-mapper.tsx Outdated
Comment thread src/features/abstract-resource-calendar/utils/event-calendar-mapper.tsx Outdated
Comment thread src/features/abstract-resource-calendar/components/arc-academic-semester-card.tsx Outdated
Comment thread src/features/abstract-resource-calendar/components/arc-event-card.tsx Outdated
Comment thread src/features/abstract-resource-calendar/utils/get-modal-header.ts Outdated
Comment thread src/features/abstract-resource-calendar/utils/get-modal-header.test.ts Outdated
@GTR1701 GTR1701 self-assigned this Feb 17, 2026
Comment thread src/features/abstract-resource-calendar/utils/get-modal-header.ts Outdated
Comment thread src/features/abstract-resource-calendar/utils/find-existing-day-swap.ts Outdated
Comment thread src/features/abstract-resource-calendar/utils/get-events-for-day.ts Outdated
Comment thread src/features/abstract-resource-calendar/utils/event-calendar-mapper.tsx Outdated
Comment thread src/features/abstract-resource-calendar/components/arc-event-card.tsx Outdated
@GTR1701
GTR1701 force-pushed the refactor/calendar-date-unification branch from 215cc9f to 13bd8a0 Compare February 19, 2026 10:55
@GTR1701
GTR1701 requested a review from kguzek February 19, 2026 11:19
Copilot AI review requested due to automatic review settings March 25, 2026 12:57
@GTR1701
GTR1701 force-pushed the refactor/calendar-date-unification branch from c823863 to e5bdaf7 Compare March 25, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • clickedDay is expected to be the day key (e.g. "2024-03-15") coming from calendar clicks, but the test now passes a localized formatted string. Since getModalHeader formats clickedDay internally, this makes the test environment-dependent and may fail parsing. Pass the raw day key into getModalHeader and 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.

Comment thread src/features/abstract-resource-calendar/components/arc-holiday-card.tsx Outdated
Comment thread src/features/abstract-resource-calendar/components/arc-internal.tsx Outdated
Comment thread src/features/abstract-resource-calendar/utils/get-modal-header.ts

@kguzek kguzek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GTR1701
GTR1701 merged commit aa83152 into main Mar 25, 2026
8 checks passed
@GTR1701
GTR1701 deleted the refactor/calendar-date-unification branch March 25, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants