slickgrid-universal icon indicating copy to clipboard operation
slickgrid-universal copied to clipboard

feat!: migrate from Moment to Tempo

Open ghiscoding opened this issue 1 year ago • 3 comments

  • after more Googling, 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
    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

  • [x] 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
  • [x] all unit tests should pass (except a.m. format, they all do)
  • [x] 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

ghiscoding avatar May 05 '24 06:05 ghiscoding

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

cc @zewa666

ghiscoding avatar May 05 '24 06:05 ghiscoding

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 05 '24 06:05 codecov[bot]