Skip to content

refactor: replace moment.js with date-fns across entire project#329

Merged
alvachien merged 3 commits into
masterfrom
fix/lib
Jun 6, 2026
Merged

refactor: replace moment.js with date-fns across entire project#329
alvachien merged 3 commits into
masterfrom
fix/lib

Conversation

@alvachien

Copy link
Copy Markdown
Owner

Summary

Replace deprecated moment.js with date-fns v4 across the entire project. All date handling now uses native Date types with date-fns functions.

Changes

  • Removed moment from package.json and angular.json
  • Added date-fns v4 as dependency
  • Date format changed from YYYY-MM-DD (moment) to yyyy-MM-dd (date-fns)
  • All moment.Moment type annotations replaced with Date
  • All moment method calls migrated to date-fns equivalents

Files changed: 88

  • Core models: common, utility, uicommon, uimodel, financemodel, eventmodel, librarymodel, homedef, blogmodel
  • Services: finance-storage, finance-odata, event-storage, uistatus
  • Components: All finance, event, library pages (~45 files)
  • Spec files: All model, service, and page spec files (~22 files)
  • Config: package.json, angular.json
  • Docs: README.md, credits.component.ts

Verification

  • ng build passes with zero errors
  • Zero moment references remain anywhere in the codebase

🤖 Generated with Claude Code

alvachien and others added 3 commits June 6, 2026 18:10
Remove moment.js dependency and migrate all date handling to date-fns v4.
All moment.Moment types replaced with native Date. date format string
changed from 'YYYY-MM-DD' (moment) to 'yyyy-MM-dd' (date-fns).

Key changes:
- Remove moment from package.json and angular.json
- Add date-fns as dependency
- Update core model files (common, utility, financemodel, eventmodel,
  librarymodel, homedef, blogmodel, uicommon)
- Update all services (finance-storage, finance-odata, event-storage,
  uistatus)
- Update all finance/event/library/report components (~80 files)
- Update all spec test files
- Update README.md and credits page

Build verified: ng build passes with zero errors.
No moment references remain anywhere in the codebase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…document creation tests

buildFinOrders() created fake Orders without ValidFrom/ValidTo (commented out),
causing Document.onVerify() to return false with InvalidActivity error. This
prevented createAssetValChgDocument from being called, making 2 tests fail.
… parse errors

After the moment.js -> date-fns refactor, several tests flush mock data with
Date objects but the service map functions expect string dates (calling
parse(string, ...)). This caused 4 unhandled 'dateString.match' errors that
made CI fail with exit code 1 even though all tests passed.

- event-storage.service.spec.ts: Use plain objects with startTimePoint/
  endTimePoint string dates instead of EventHabitDetail instances
- finance-odata.service.spec.ts: Use string date formats for TranDate,
  StartDate, EndDate in mock API responses
@alvachien alvachien merged commit 67483ea into master Jun 6, 2026
1 check 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.

1 participant