Skip to content

Perf: swap the moment.js usage for date-fns - #1582

Merged
Baskarayelu merged 5 commits into
Remitwise-Org:mainfrom
1nonlypiece:perf/1491-date-fns
Jul 30, 2026
Merged

Perf: swap the moment.js usage for date-fns#1582
Baskarayelu merged 5 commits into
Remitwise-Org:mainfrom
1nonlypiece:perf/1491-date-fns

Conversation

@1nonlypiece

Copy link
Copy Markdown
Contributor

Summary

There's no moment usage anywhere in the codebase to literally swap, but app/dashboard/transaction-history/page.tsx has exactly the kind of hand-rolled date arithmetic date-fns exists to replace: a custom startOfDay, manual millisecond-timestamp comparisons for date-range grouping, and toDate.setHours(23, 59, 59, 999) to compute end-of-day. Adds date-fns and swaps all of it for startOfDay/subDays/isSameDay/endOfDay/isBefore/isAfter -- same behavior, less custom date math to maintain, and isSameDay in particular is more obviously correct than comparing two millisecond timestamps for equality.

Also adds react-window as a dependency (without it, this file -- and therefore this PR's own new test -- can't even be imported; full fix, including removing the @ts-ignore/as any workaround around it, is scoped to #1581 to keep this PR's diff focused on the date-fns swap).

Testing

  • node node_modules/vitest/vitest.mjs run ... tests/unit/dashboard/transaction-history-date-grouping.test.ts -- 4/4 pass, covering same-day/yesterday/older/future dates against getGroupKey
  • npm run test:unit:vitest -- 301 passing (was 297 on main), zero regressions
  • npx eslint app/dashboard/transaction-history/page.tsx -- clean
  • npx tsc --noEmit -- no new errors in the touched file

Closes #1491

@Baskarayelu
Baskarayelu merged commit 4cb2ca7 into Remitwise-Org:main Jul 30, 2026
7 of 12 checks passed
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.

Perf: swap the moment.js usage for date-fns

2 participants