Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: migrate from Moment to Tempo #1507

Merged
merged 10 commits into from May 6, 2024
Merged

feat!: migrate from Moment to Tempo #1507

merged 10 commits into from May 6, 2024

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented May 5, 2024

  • after more research, I found Tempo and I can finally migrate away from MomentJS. Tempo is simple, is ESM, is small and has all necessary functions to replace Moment
  • by removing Moment (finally), we also get a much smaller build (not surprisingly since it's ESM)
  • Few notes about Tempo
    1. it uses the exact same format tokens as Moment (awesome)
    2. it doesn't support multiple formats like Moment did for parsing with/without zero padding but that doesn't matter since the non-padding token works for both usage (e.g. 'M/D/YY' will work for both '4/7/24' and '04/07/24'). With that in mind, I will use 'M/D/YY' to parse but I will use 'MM/DD/YY' to format date output

TODOs

  • investigate why locally a token is showing locally as a.m. but in CI it's showing as am (I would prefer same result on both side as am). I might need to open an issue on Tempo. I found out that it's caused by Intl.DateTimeFormat displaying a.m. when using "en-CA" but am when using "en-US" and so I'll use "en-US" everywhere to avoid such inconsistenticies
  • all unit tests should pass (except a.m. format, they all do)
  • all Cypress E2E tests should pass
  • requires Migration Guide & other docs update

Build Size Comparison

File before after diff % diff
SF Bundle Zip File 549Kb (562,835) 535Kb (548,088) -14Kb 2.62% smaller
GitHub Vite Demo Website 5.16Mb (5,412,541) 5.11Mb (5,364,919) -0.05Mb 0.88% smaller

- I can finally migrate away from MomentJS, [Tempo](https://tempo.formkit.com) is simple, ESM, small and has all necessary functions to replace Moment
Copy link

stackblitz bot commented May 5, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ghiscoding
Copy link
Owner Author

cc @zewa666

Copy link

codecov bot commented May 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.8%. Comparing base (bf732bc) to head (9249c7b).

Additional details and impacted files
@@           Coverage Diff           @@
##            next   #1507     +/-   ##
=======================================
+ Coverage   99.8%   99.8%   +0.1%     
=======================================
  Files        197     198      +1     
  Lines      21584   21616     +32     
  Branches    6911    7217    +306     
=======================================
+ Hits       21520   21552     +32     
+ Misses        64      58      -6     
- Partials       0       6      +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ghiscoding ghiscoding merged commit adef47f into next May 6, 2024
6 checks passed
@ghiscoding ghiscoding deleted the feat/tempo-migration branch May 6, 2024 17:32
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.

None yet

2 participants