From 1ee4a68992c4687d20f857b057a797397f47d038 Mon Sep 17 00:00:00 2001 From: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:07:39 +0530 Subject: [PATCH 1/2] perf: reuse changelog calendar formatter for each commit --- resources/js/lib/changelog.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/js/lib/changelog.ts b/resources/js/lib/changelog.ts index 4aa6d9636..8f1330700 100644 --- a/resources/js/lib/changelog.ts +++ b/resources/js/lib/changelog.ts @@ -43,11 +43,10 @@ export function changelogDays( timeZone: string, ): ChangelogDay[] { const days: ChangelogDay[] = []; + const calendar = new Intl.DateTimeFormat('en-CA', { timeZone }); for (const commit of commits) { - const date = new Date(commit.committed_at).toLocaleDateString('en-CA', { - timeZone, - }); + const date = calendar.format(new Date(commit.committed_at)); let day = days.at(-1); if (day?.date !== date) { From f8ba1b60ae59803f96de26608e39957d86bb5f42 Mon Sep 17 00:00:00 2001 From: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:02:45 +0530 Subject: [PATCH 2/2] fix: preserve invalid date fallback in changelog formatter --- resources/js/lib/changelog.ts | 5 ++++- tests/Unit/Changelog.test.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/resources/js/lib/changelog.ts b/resources/js/lib/changelog.ts index 8f1330700..3be6b60e7 100644 --- a/resources/js/lib/changelog.ts +++ b/resources/js/lib/changelog.ts @@ -46,7 +46,10 @@ export function changelogDays( const calendar = new Intl.DateTimeFormat('en-CA', { timeZone }); for (const commit of commits) { - const date = calendar.format(new Date(commit.committed_at)); + const parsed = new Date(commit.committed_at); + const date = Number.isNaN(parsed.getTime()) + ? 'Invalid Date' + : calendar.format(parsed); let day = days.at(-1); if (day?.date !== date) { diff --git a/tests/Unit/Changelog.test.ts b/tests/Unit/Changelog.test.ts index 23d33f856..448f4b2b1 100644 --- a/tests/Unit/Changelog.test.ts +++ b/tests/Unit/Changelog.test.ts @@ -94,3 +94,12 @@ void test('names the day relative to today in the reader’s time zone', () => { assert.deepEqual(changelogDayHeading('2026-10-14', 'Europe/Budapest', now), { title: 'Wednesday', date: 'Oct 14' }); assert.deepEqual(changelogDayHeading('2025-12-31', 'Europe/Budapest', now), { title: 'Wednesday', date: 'Dec 31, 2025' }); }); + +void test('keeps grouping when a commit has an invalid timestamp', () => { + const days = changelogDays( + [commit(1, 'not-a-date', 'alice'), commit(2, '2026-10-18T03:30:00Z', 'bob')], + 'Europe/Budapest', + ); + + assert.deepEqual(days.map((day) => day.date), ['Invalid Date', '2026-10-18']); +});