Fix commit list crash on out-of-range authored dates
What does this MR do and why?
The refactored Commit List does its date grouping and formatting client-side, where JavaScript's Date is bound by the ECMA-262 spec to years between roughly −271,821 and +275,760.
Git, however, stores commit timestamps as a signed 64-bit number with no such limit, so the GraphQL API can legitimately return dates outside that range (e.g. +292278994-08-17T07:12:55+00:00 on the spooky-stuff test branch).
When that happens, every formatter built on top of Date, Intl.DateTimeFormat, localeDateFormat, TimeagoTooltip, throws RangeError: Invalid time value and the whole page fails to render. The legacy view never hit this because dates were pre-formatted server-side by Ruby's Time.
This MR adds three minimal guards using the existing isValidDate helper so out-of-range dates fall back to the raw ISO string instead of crashing the page:
projects/commits/utils.js:groupCommitsByDayfalls back to the rawauthoredDateas
the day key (otherwise unparseable dates silently collapse into a single"NaN-NaN-NaN"bucket).commit_list_app.vue:getFormattedDatereturns the raw input whennew Date(...)is
invalid, so the day-header<time>element keeps rendering.commit_list_item.vue:<timeago-tooltip>is rendered conditionally; when the date is unparseable, a plain<span>with the raw string is shown in its place.
References
Issue: #591885 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
Page fails to render — RangeError: Invalid time value |
Page renders; the spooky commit |
| shows its raw ISO timestamp inline | |
![]() |
![]() |
How to set up and validate locally
- Enabled
Feature.enable(:project_commits_refactor) - Navigate to the affected branch: (http://gdk.test:3000/gitlab-org/gitlab-test/-/commits/spooky-stuff)
- Before this MR: the page fails to render and the console shows RangeError: Invalid time value.
- After this MR: the page renders fully. The commit
ba3343bc4fa403a8dfbfcab7fc1a8c29ee34bd69shows its raw +292278994-… timestamp inline; every other commit formats normally asMon DD, YYYY - with a working timeago tooltip.
- Toggle the feature flag off and confirm the legacy view still works as before (no regression).

