top | item 15276813

How I cut my Webpack bundle size in half

24 points| celerity | 8 years ago |jmduke.com

3 comments

order
[+] anonova|8 years ago|reply
In regards to date management, has anyone ever replaced moment with date-fns: https://date-fns.org/ ? It seems to be the lodash for dates, in which you can do selective imports.
[+] WorldMaker|8 years ago|reply
As a further alternative, I keep wondering what's left to further standardize towards Intl.DateTimeFormat [1][2] to leave it to the browsers to know the local locale?

I suppose for me and my projects perhaps the biggest usages of Moment are actually for the "humanizing" formats time until/time since (the things like "20 minutes ago"/"3 days from now"). The locale data for those likely may never be standardized into Intl. (~I also don't see equivalents of those functions in a quick skim of date-fns docs, fwiw.~ ETA: Of course I spot it soon after posting the comment; formatDistance)

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

[2] http://caniuse.com/#search=intl

[+] ch_sm|8 years ago|reply
yes, using it in production for this exact reason. seems to have all the features moment has + it does not mutate date objects in place. thumbs up!