moira icon indicating copy to clipboard operation
moira copied to clipboard

Enhancement :- Move from momentjs to date-fns to improve performance

Open siddhant1 opened this issue 5 years ago • 8 comments

This is a very small enhancement in the editor but I we should use date-fns over momentjs because it is super small and imporves performance.

Links :- https://twitter.com/addyosmani/status/1037587112730611714?lang=en

siddhant1 avatar Mar 01 '19 15:03 siddhant1

We have moment-locales-webpack-plugin, which remove all locales except en.

We also have webpack-bundle-analyzer.

So, what I want...

  • [ ] check "before code" by bundle-analyzer
  • [ ] remove moment
  • [ ] add date-fns
  • [ ] check "after code" by bundle-analyzer
  • [ ] compare two results and post it with PR

sashasushko avatar Mar 04 '19 11:03 sashasushko

Cool , I will have a look

siddhant1 avatar Mar 04 '19 13:03 siddhant1

@siddhant1 how are you going? Need help?

sashasushko avatar Mar 18 '19 05:03 sashasushko

Day.Js is a nice alternative to me

⏰ Day.js 2KB immutable date library alternative to Moment.js with the same modern API

https://github.com/iamkun/dayjs

ghost avatar Mar 18 '19 08:03 ghost

@xxyuk if you will send PR, I review it asap

sashasushko avatar Mar 19 '19 06:03 sashasushko

@sashasushko i would prefer date-fns due to following reasons:

  1. date-fns is immutable. That is it returns new Date instance from function which was run rather changing its own state.
  2. date-fns is divided by function level. So only those things will be imported which are needed.

hv7214 avatar Feb 17 '20 09:02 hv7214

@hv7214 it's argument :-)

So, you can send pull request. I'll review it. And, if need, we'll discuss date-fns at pull request

sashasushko avatar Feb 17 '20 11:02 sashasushko

@sashasushko yeah sure : )

hv7214 avatar Feb 17 '20 13:02 hv7214