dayjs: 🎁 2.0 Milestones【Breaking Change】
We want to make some changes to make Day.js modern and in a standard JS way.
And this would be a breaking change because of these changes below:
Make TypeScript definition the same behavior as JS code
Update types/index.d.ts
to export default dayjs;
Mark the correct ES6 Module entry
<del>Update package.json “module” to “esm/index”, (won’t introduce in “dayjs”, see https://github.com/iamkun/dayjs/issues/1281#issuecomment-754381268)</del>
Publish a new NPM package, maybe “dayjs-esm” to ship an ESM module with package.json
module entry pointed to. ref https://github.com/iamkun/dayjs/issues/1242#issuecomment-734321931
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 15
- Comments: 37 (13 by maintainers)
Commits related to this issue
- fix: processing menu now appears correctly on small screens + bump dayjs from 1.11.10 to 2.0.0-alpha.4 - see iamkun/dayjs#1281 — committed to data-fair/processings by EDM115 4 months ago
For 2.0, I think ESM should be the default. That is the way the whole world is moving. Then we could create
dayjs-umd
or whatever if it’s really necessary to have multiple packagesAny news on this 2.0 version ?
This change in 1.10.1 add ES6 Module Support, package.json module point to “esm/index.js” (#1298) (f63375d)
really has an unexpected breaking change, and that’s of course not what we want.
I am planning to revert this change in the next release 1.10.2 and delete the “module” entry.
Besides, maybe there’s no need for Day.js to support ESM bundle, this would only introduce some conflict but no benefits in the tree shaking. A better way might be a separate npm package (like “dayjs-esm”) to ship an ESM package.
I’m going to +1 here to say that unfortunately this
dayjs
update broke the build (while preparing a 1.0 release) and we had to lock the version to 1.9.6 (I saw someone had success with 1.9.7 too).Thanks for doing better TypeScript support and also for the dayjs package itself, @iamkun. OSS does not get enough positive support - thanks for doing this for all of us who use the package on many projects and only come to Github to figure out what broke the build.
Thanks!
I wanna point out, the recent typescript changes done in 1.10 actually broke in my project with the way that it was documented online on how to install/use dayjs in angular
Error:
"export 'extend' (imported as 'dayjs') was not found in 'dayjs'
So there already has been breaking changes, especially with usage on typescript so might as well just push these changes over since people are gonna have to update their projects
I just made the version in package.json hard value to the last known working version:
1.9.7
like so:"dayjs": "1.9.7",
If dayjs is gonna add breaking changes without increasing their major version, I might as well just lock the version 😃
@TheThing I have the same issue. did you fixed yours? How?
I tried something like this:
@vhscom It is still very early in the process and there may be potential bugs, and unit tests, plugins and locales have not yet been migrated.
@iamkun WDYT? We can release
2.0.0-alpha.0
by now?Just released v1.10.2 to revert the esm
module
entry.Let leave this breaking change to v2.0.0
More fun facts.
This doesn’t work in 1.10.1 in angular:
However this will make it work
lol
@bboydflo this is how you fix that stupid error xD
v2.0 branch https://github.com/iamkun/dayjs/tree/next
@alexsorokoletov THX, you can use the latest version of Day.js which has reverted this error change.