Skip to content

fix: stop stash manager showing Invalid Date for every entry - #154

Merged
devlint merged 8 commits into
mainfrom
fix/151-stash-invalid-date
Aug 11, 2026
Merged

fix: stop stash manager showing Invalid Date for every entry#154
devlint merged 8 commits into
mainfrom
fix/151-stash-invalid-date

Conversation

@devlint

@devlint devlint commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • git_stash_list requested git's lenient %ai date format ("2026-08-11 09:16:44 +0200" — space-separated, colon-less offset). StashManager.vue's formatDate() fed that straight into new Date(), which is implementation-defined for that shape — JavaScriptCore (the shipped macOS/Linux Tauri webview) rejects it, silently producing an Invalid Date with no exception thrown, so the existing try/catch never fired. V8 (Node/dev:web) and WebView2 (Windows) both tolerate the lenient format, which is why this shipped unnoticed.
  • Fixed by switching the git format placeholder from %ai to %aI (strict ISO 8601) — matching the convention already used at 8 other call sites in this codebase.
  • Aligned the dev-server.mjs route onto the same %aI placeholder, which also fixes a second latent divergence: the Rust side used the author date, the dev-server used the committer date. Both sides now emit "whatever git prints for %aI".
  • Un-blanked the date field in the Rust↔Node parity test (it was previously masked with a comment noting the format "can vary subtly") so this exact regression is caught if it ever recurs.
  • Added a real Number.isNaN(d.getTime()) guard in StashManager.vue's formatDate() — the existing try/catch was dead code since new Date() never throws.
  • Bundled a sibling fix: git_list_tags had the same defect (%(taggerdate:iso), lenient) causing "NaN years ago" in the Tags panel — switched to :iso-strict with the same Number.isNaN guard in TagsPanel.vue.

Fixes #151.

Test plan

  • New Rust tests (stash_and_tag_date_tests): strict-ISO-8601 shape assertion + round-trip against git's own --date=iso-strict output, for both stash and tag dates — cargo test --lib: 183 passed
  • pnpm test:parity — 15 passed, including the now-real (un-blanked) git-stash-list date comparison
  • StashManager-date.test.ts (new) — 3 cases: +HH:MM offset, Z-suffixed UTC, and a garbage string all fall back correctly
  • Full desktop vitest run — 678 passed; vue-tsc --noEmit — clean
  • Manual QA via pnpm dev:web against a real stash: Stash Manager now shows a real formatted date ("11 août, 13:51") instead of "Invalid Date"
  • Visual confirmation in the actual packaged Tauri webview (JavaScriptCore) — not run, no Tauri build available in the dev environment; the fix is verified at the string-shape level (strict ISO 8601 is parseable by every JS engine, unlike the old lenient format)

@devlint
devlint merged commit 0682640 into main Aug 11, 2026
4 checks passed
@devlint
devlint deleted the fix/151-stash-invalid-date branch August 11, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid date in stash manager

1 participant