Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing moment.js dependence as it's now considered as a legacy project #26759

Closed
1 task done
Fcmam5 opened this issue Sep 15, 2020 · 14 comments
Closed
1 task done
Labels
improvement improve some features Inactive

Comments

@Fcmam5
Copy link

Fcmam5 commented Sep 15, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

I believe that this has been reported many times, but now as Moment.js is considered as a legacy project in maintenance mode (see: https://momentjs.com/docs/#/-project-status/), in addition to the problems that we may face when working with it (bundle size, mutable APIs..)

What does the proposed API look like?

Switch to any date library.

@xiaoxiangmoe
Copy link

ng-zorro-antd use date-fns

@afc163 afc163 added the improvement improve some features label Sep 17, 2020
@zazzaz
Copy link

zazzaz commented Sep 17, 2020

I recommend Day.js with antd-dayjs-webpack-plugin.

It's super easy to use and replace Moment.js is just one second. Every syntax and APIs are just exacetlly the same with nothing else to learn.

According to Moment.js's recommandation on their website:

Day.js is designed to be a minimalist replacement for Moment.js, using a similar API. It is not a drop-in replacement, but if you are used to using Moment's API and want to get moving quickly, consider using Day.js.

@breezewish
Copy link

Day.js can be the first-class citizen in Antd, replacing all momentjs occurrence natively, instead of just being available as a plugin mentioned in #26759 (comment) . This also resolves issues like ant-design/antd-dayjs-webpack-plugin#23

@int64ago
Copy link
Contributor

It's a break change, maybe antd v5 ?

@zombieJ
Copy link
Member

zombieJ commented Sep 18, 2020

Yes. We have notice this. Since this will be a breaking change, we may not do action immediately in current version.

@xiaoxiangmoe
Copy link

xiaoxiangmoe commented Sep 18, 2020

dayjs and moment have the same API. They both have mutable API, which are easy to misuse.

Why not change to a new immutable library in this breaking change?

@zazzaz
Copy link

zazzaz commented Sep 18, 2020

@xiaoxiangmoe Day.js is 2kB size and immutable, that's the main difference from moment.js.

@sgb-io
Copy link

sgb-io commented Nov 11, 2020

Any information about what would not be backwards compatible using dayjs? It can be seen in #26807

@jeferson-sb
Copy link

any news on this one?

@masbaehr
Copy link

I was searching for a UI library, found ant-design, checked bundlephobia, and was shocked ;-)
Moment.js really should be replaced its a whopping 23% of the bundle size.
https://bundlephobia.com/result?p=antd@4.10.3

@glebdv
Copy link

glebdv commented Jan 25, 2021

+1

@adisrael
Copy link

Luxon looks like the natural replacement of moment:

@glebdv
Copy link

glebdv commented Jan 29, 2021

@adisrael
Most alternatives are all looking pretty good, so it will take a small proof of concept to figure out which one is better.
Luxon is less popular, then date-fns, then dayjs in github stars (aka community love)
date-fns has most downloads, then it's dayjs then luxon
luxon also has less open issues (but smaller community, so who knows)
dayjs is the smallest in size and customizable to your needs
under the hood differences, etc

So there are definitely things to consider before making a choice. So far Ive used date-fns and dayjs with multiple lang support and perso I prefer dayjs, but yeah, that's my flavor because I tend to like smaller packages (queue explicit joke).

@afc163
Copy link
Member

afc163 commented Nov 6, 2022

moment.js is replaced by dayjs in #34057

@afc163 afc163 closed this as completed Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement improve some features Inactive
Projects
None yet
Development

No branches or pull requests