scriptum
You-Dont-Need-Momentjs
Our great sponsors
scriptum | You-Dont-Need-Momentjs | |
---|---|---|
1 | 18 | |
382 | 13,219 | |
0.3% | -0.0% | |
9.1 | 5.7 | |
about 13 hours ago | 4 months ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
scriptum
You-Dont-Need-Momentjs
-
What are some of the best libraries you cannot work without?
It’s been a few years since I looked at moment.js, but you couldn’t tree-shake it properly back then. That’s when I found this: https://github.com/you-dont-need/You-Dont-Need-Momentjs
- Common Date formatter libraries in React (TypeScript)
-
Day.js - Fast 2kB alternative to Moment.js with the same modern API
Moment is considered a legacy project now. So you might want to rethink using it. Moment isn't as great as it used to be and native's capabilities are a lot more advanced that they were before.
-
You don't (may not) need Moment.js
In JavaScript you actually use `Intl.DateTimeFormat`[1] to format datetimes, which takes in a pretty descriptive configuration object with keys such as `month: "short"`, `hour: "2-digit"`, and `hour12: true`.
This is missing in the OP explainer, so I created a PR[2].
1: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
2: https://github.com/you-dont-need/You-Dont-Need-Momentjs/pull...
- Have you guys tried any alternatives to Moment.js?
-
The best JavaScript date libraries in 2021
The Day.js documentation claims "If you use Moment.js, you already know how to use Day.js", which would make migrating easier. You can see direct comparisons at the excellent You don't (may not) need Moment.js. The code in our example CodePen is readable with the exception of the parsing and time zone cases.
What are some alternatives?
dayjs - ⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
import-maps - How to control the behavior of JavaScript imports
date-fns - ⏳ Modern JavaScript date utility library ⌛️
proposal-temporal - Provides standard objects and functions for working with dates and times.
js-joda - :clock2: Immutable date and time library for javascript
Fluture - 🦋 Fantasy Land compliant (monadic) alternative to Promises
melange - A mixture of tooling combined to produce JavaScript from OCaml & Reason
datetime-rs - Rust date and time library
protoss - Zeta Ret ProtoSS Library - Prototype Supers-Subclass ~ 1kb (Polymorphism, Prototypes, OOP)
proposal-temporal-v2 - Future additions to Temporal
crocks - A collection of well known Algebraic Data Types for your utter enjoyment.
vo