You-Dont-Need-Momentjs
proposal-temporal-v2
Our great sponsors
You-Dont-Need-Momentjs | proposal-temporal-v2 | |
---|---|---|
18 | 1 | |
13,219 | 19 | |
-0.0% | - | |
5.7 | 0.0 | |
4 months ago | about 3 years ago | |
JavaScript | HTML | |
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.
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.
proposal-temporal-v2
-
You don't (may not) need Moment.js
Yes, it's always been possible to get some kind of string from datetimes, but I specifically care about specifying what string, same with parsing. "Just use a locale's default" might work if you're making a web app for clients who aren't picky, but using JS as a "serious" language it's a really big hole. There's plenty of formats that demand non-ISO date formats and I currently need to use a third-party library. I've gotten used to than in JS, but I was hoping a new take on dates will sort this out. Oh well, I'll have to just hope it makes it to v2: https://github.com/js-temporal/proposal-temporal-v2.
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
datetime-rs - Rust date and time library
scriptum - Functional Programming Unorthodoxly Adjusted to Client-/Server-side Javascript
vo
ngx-moment - moment.js pipes for Angular
webpack - A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.