you-dont-need/You-Dont-Need-Momentjs: List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin


63 bookmarks. First posted by derjan september 2018.


Moment.js is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.

Problems with Moment.js:

* It is highly based on OOP APIs, which makes it fail to work with tree-shaking, thus leading to a huge bundle size and performance issues.
* It is mutable due to OOP APIs and non-pure functions, which cause bugs: https://github.com/moment/moment/blob/develop/src/test/moment/add_subtract.js#L244-L286

If you are not using timezone but only a few simple functions from moment.js, this might bloat your app, and therefore is considered overkill. dayjs has a smaller core and has very similar APIs so it makes it very easy to migrate. date-fns enables tree-shaking and other benefits so that it works great with React, Sinon.js, and webpack, etc. See https://github.com/moment/moment/issues/2373 for more ideas on why and how people switch from moment.js to other solutions.
GitHub  JavaScript  date  library 
10 weeks ago by coffeebucket
List of date-fns or native functions which you can use to replace moment.js. Moment.js is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.
moment  time  javascript  plugins  library  youdontneed  optimization  performance  date  youmightnotneed 
october 2018 by spaceninja
via dfjs’s Activity
opensource 
october 2018 by darren
Github repo
Name: You-Dont-Need-Momentjs
Tagline: List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin
Languages:
JavaScript = 27518 bytes

# You don't (may not) need Moment.js

[Moment.js](https://momentjs.com/) is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.

![Large bundle size](./screenshot.png)

Problems with Moment.js:

- It is highly based on OOP APIs, which makes it fail to work with tree-shaking, thus leading to a huge bundle size and performance issues.
- It is mutable due to OOP APIs and non-pure functions, which cause bugs:
https://github.com/moment/moment/blob/develop/src/test/moment/add_subtract.js#L244-L286

If you are not using timezone but only a few simple functions from moment.js, this might bloat your app, and therefore is considered overkill. [dayjs](https://github.com/iamkun/dayjs) has a smaller core and has very similar APIs so it makes it very easy to migrate. [date-fns](https://github.com/date-fns/date-fns) enables [tree-shaking and other benefits](https://github.com/date-fns/date-fns/issues/275#issuecomment-264934189) so that it works great with React, Sinon.js, and webpack, etc. See https://github.com/moment/moment/issues/2373 for more ideas on why and how people switch from moment.js to other solutions.

## Brief Comparison

| Name | Size(gzip) | Tree-shaking | Popularity | Methods richness | Pattern | Timezone Support | Locale |
| ---------------------------------------- | --------------------------------- | ------------ | ---------- | ---------------- | ---------- | --------------------- | ------ |
| [Moment.js](https://momentjs.com/) | 329K(69.6K) | No | 38k | High | OO | Good(moment-timezone) | 123 |
| [date-fns](https://date-fns.org) | 78.4k(13.4k) without tree-shaking | Yes | 13k | High | Functional | Not yet | 46 |
| [dayjs](https://github.com/iamkun/dayjs) | 6.5k(2.6k) without plugins | No | 14k | Medium | OO | Not yet | 23 |

## Voice of Developers

> [Removed moment.js to replace with date-fns - build output reduced by 40%](https://github.com/oysterprotocol/webnode/pull/116)

> &mdash;<cite>Jared Farago from [webnode](https://github.com/oysterprotocol/webnode/pull/116) project.</cite>

> [Make use of native JavaScript object and array utilities before going big. Good library if you’re looking to replace Moment.js for one reason or another. Immutable too.](https://twitter.com/dan_abramov/status/805030922785525760)

> &mdash;<cite>Dan Abramov, Author of [Redux](https://github.com/reduxjs/redux) and co-author of [Create React App](https://github.com/facebook/create-react-app). Building tools for humans.</cite>

> [I strongly recommend using date-fns over Moment.js, it's has a nicer API and you can...
github  programming  github-starred-to-pinboard 
september 2018 by brianyang
List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin
javascript  GitHub_Repos 
september 2018 by GameGamer43
List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin - you-dont-need/You-Dont-Need-Momentjs
date  javascript 
september 2018 by narven
dueyfinster starred you-dont-need/You-Dont-Need-Momentjs
javascript  library 
september 2018 by dueyfinster
you-dont-need/You-Dont-Need-Momentjs Moment.js is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size. via Pocket
ifttt  pocket  datefnsjs  javascript  library  momentjs  programming  reference 
september 2018 by jeremyday
List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin - you-dont-need/You-Dont-Need-Momentjs
javascript  datetime 
september 2018 by geetarista
Moment.js is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.
september 2018 by davidmatas
Moment.js is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.
optimization  library  javascript 
september 2018 by Gwendoux
Date 日期库
library  JavaScript 
september 2018 by Linvader
fabianmoronzirfas starred you-dont-need/You-Dont-Need-Momentjs
github  stars 
september 2018 by fabianmoronzirfas
waako starred you-dont-need/You-Dont-Need-Momentjs Saved: September 16, 2018 at 10:35AM

waako
starred
you-dont-need/You-Dont-Need-Momentjs

you-dont-need/You-Dont-Need-Momentjs

List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin

JavaScript

3.1k

2 issues need help

Updated Sep 16
github  needs-tags 
september 2018 by waako
you-dont-need/You-Dont-Need-Momentjs
from twitter
september 2018 by sammyrulez
from ifttt: icco’s Activity https://github.com/icco
IFTTT  github  code 
september 2018 by icco
List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin - you-dont-need/You-Dont-Need-Momentjs
programming  development  web  webdev  inspiration  resources  MomentJS  JavaScript 
september 2018 by lenards
You don't (may not) need Moment.js via @instapaper
from instapaper
september 2018 by technovangelist
Moment.js is a fantastic date library with lots of great features and utilities. However, when you are working on a performance sensitive web application, it might have a huge performance overhead because of the complex API and large bundle size.
javascript  next-project 
september 2018 by mbrictson
List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin - you-dont-need/You-Dont-Need-Momentjs
javascript  lib  devteamtipp 
september 2018 by HusseinMorsy