This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
RFC: Make DatePicker/TimePicker/Calendar date-library-agnostic #8649
Comments
WIll the adapters be small in size? another concern with moment related to unmodular is the huge size. What are the most common operations on time and date in antd that brings in the need for a library? can we detect those and see if its better to have adapters or just write our own antd date helpers? i guess we dont want to maintain own code managing dates but if the result is less code than adapters it should be considered. |
Should We can add a common method in rc-[xxx]-adapter like |
The adapter should be very small. I don't think we will repalce moment with our own date helper, because we don't want break any exists code, but we can have a |
|
Sounds great, thanks for making moment opt-in! Appreciate it! |
I really like this feature, any update on this ? |
Depending on build tools to implement type adapters is not a good solution, why don't we just make |
#10437 is a better proposal |
#10437 is closed. Should we reconsider date-library-agnostic solution here? |
Strong proponent of luxon. Its combines moment clean, easy to use API with the immutability of date-fns. there is at least one abstraction library available which may make this easier: https://github.com/dmtrKovalenko/date-io |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Previous discussions #5677, ant-design/ant-design-mobile#1217.
Motivation
moment
do have some downsides like it's mutable value and un-modular. And it's road to modular seems very slow. I also found that the moment team is writing another date library called luxon. It would be a big improvement if we can make our date related components date-library-agnostic.Detailed design
Create a
rc-date-util
package. It only contains one line:rc-moment-adapter
wraps all APIs which date components used.All date related components use
rc-date-util
instead of usingmoment
directly.People can change date library through webpack's alias:
Browserify users can use aliasify:
After aliasing
rc-moment-adapter
torc-date-fns-adapter
, all dates pass to callbacks should change to native date object as well.This change won't effects any users who don't want to change moment to other date library.
Drawbacks
Rely on build tool config.
The text was updated successfully, but these errors were encountered: