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


62 bookmarks. First posted by derjan 9 weeks ago.


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 
6 days 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 
5 weeks ago by spaceninja
via dfjs’s Activity
opensource 
6 weeks ago 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 
6 weeks ago by brianyang
List of date-fns or native functions which you can use to replace moment.js + ESLint Plugin
javascript  GitHub_Repos 
7 weeks ago 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 
7 weeks ago by narven
dueyfinster starred you-dont-need/You-Dont-Need-Momentjs
javascript  library 
8 weeks ago 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 
8 weeks ago 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 
8 weeks ago 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.
8 weeks ago 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 
8 weeks ago by Gwendoux
Date 日期库
library  JavaScript 
8 weeks ago by Linvader
fabianmoronzirfas starred you-dont-need/You-Dont-Need-Momentjs
github  stars 
8 weeks ago 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 
8 weeks ago by waako
you-dont-need/You-Dont-Need-Momentjs
from twitter
8 weeks ago by sammyrulez
from ifttt: icco’s Activity https://github.com/icco
IFTTT  github  code 
8 weeks ago 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 
8 weeks ago by lenards
You don't (may not) need Moment.js via @instapaper
from instapaper
8 weeks ago 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 
9 weeks ago 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 
9 weeks ago by HusseinMorsy