🌟 Day.js 2.0 alpha preview is available
See original GitHub issueThe v2 branch is here #2066
If you have issues with v2, please comment on this issue. Please do not comment on irrelevant content.
Changelog
- supports ESM
Outdated
The information is outdated, we’re planning them released when v3.0.
Changelog
2.0.0-alpha.0
⚠️ At this very early stage, some plugins and locales have not been implemented. (PR welcomed) ⚠️ v2 has been rewritten. The compatibility of any private API is not guaranteed.
Breaking Change
dayjs.locale(preset, object, isLocal)=>dayjs.locale(preset, isLocal, object)- drop support of node < 14.19.0
- importing plugins or locale (maybe will be changed in the future)
>import 'dayjs/plugin/isToday'import 'dayjs/dist/plugin/isToday'
Feature
- supports ESM
- rewrite using TypeScript
Issue Analytics
- State:
- Created a year ago
- Reactions:26
- Comments:29 (8 by maintainers)
Top Results From Across the Web
dayjs - npm
Day. js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers with a largely ...
Read more >Change Log - Ant Design
Change main in package.json to dist/antd.js . eb8835f. 🗑 Remove dist/antd.css , and add dist/reset.css to override common styles.
Read more >Hocus Pocus 2 movie review & film summary (2022)
Her witty rendition of Midler's alpha witch is sharp and funny. The local clergyman, Reverend Traske (Tony Hale) has decided that since the ......
Read more >Skullgirls - Twitter
It's new episode day for the Skullgirls series on WEBTOON! Episode 7 is now available, and Cerebella is clearly not a fan of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

IMHO it is a good idea to redo the code base for dayjs because this way we have a chance to improve the usability for typescript and add esm support. I build a minimal angular 13 project to get accustomed to the new version and here are my first findings:
‘utility-types’ is a ‘dependencies’ (not a ‘devDependencies’) used in ‘units’ (resulting in a “cannot find module ‘utility-types’” when building my angular app)
the dist folder does not contain a ‘package.json’ file after building dayjs.
It is a good practice - or a requirement? - to include a package.json to a project); even without a dependency, the generated code that will be published to npmjs, should contain a package.json to give information about the project.
to build version 2, I fetched the next branch, deleted the package-lock.json and the node_modules folder and ran ‘npm i’.
Running ‘lint’ I got 745 warnings, lots of them stating “
Delete␍eslintprettier/prettier”.OK, this is an alpha version, so this is not a problem, but the character mentioned in the warning was not an ASCII character (😉, but always at the end of all lines in the referenced files (e.g. in dayjs.ts). Just as I am curious: is this an uncommon line endings character?
Unluckily I did not find the sources of @sxzz/eslint-config-prettier and @sxzz/eslint-config-ts and their package.json did not contain a ‘repository’ tag (which is at least a good practice). @sxzz perhaps you could add this tag to your eslint packages?
As a next step, I will add more examples to my test project (e.g. using locales).
If you need a helping hand, I could contribute e.g. one of the plugins. As I am currently working on issue #1596, perhaps I could “migrate” the
customParseFormatplugin.Anyway, thanks for starting this “issue” 👍
@benmccann 2.0 supports ESM now, you can try it https://unpkg.com/browse/@sxzz/dayjs@2.0.0-alpha.2/dist/