-
Notifications
You must be signed in to change notification settings - Fork 868
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
Defining version 4 of react-datetime #723
Comments
Converting stateless components to functions would make them simpler, and it would be a good step for switching to hooks if this is desired. +1 on making moment.js optional. It's very big and it doesn't give good results with tree shaking. And lastly, its development stopped. |
Hey thanks for those insights @onlined Currently there are 2 stateful components:
And 3 stateless:
I'm not against to turn the stateless class components into functions, but I think in that case we should extract some logic from them. When the functional components are big, like these ones, I feel that class components are more readable. About the usage of hooks, I'm not a big fan of them for storing any state. I know that it's not a very popular opinion, maybe I'm too old school, but I believe in functional components when they are pure, stateless. Hooks just break that pureness making functions stateful. When I see functional components made of a bunch of function definitions inside of the main one, and multiple I'm more interested in simplifying the state of the components first, and the migration to typescript second. That would make the collaboration much simpler to anyone. Making moment.js optional would be like a dream! But I don't know event where to start from. Moment is so in the core of this library that we would need to update all the sources. |
@arqex We think alike about function vs class components. I had just said the advantage about hooks in case you wanted to switch, it's not something that I like very much either. I think the interface shouldn't depend on any date library, it should be based on native JavaScript |
My wishlist:
|
Hey @pleunv thanks for your votes! I think accessibility is very important too, we have this issue to keep track of it We are kind of moving away from imperaitive methods, but I agree that it would be easer for navigating than updating the internal |
What about to replace moment with 'dayjs'? |
It would be great to make a list with the functionality needed from moment and create a file with an abstraction of that functionality. We can call it dateManager or something similar. Once we have it, it would be possible to implement the dateManager using moment, dayjs or date-fns or whatever other library. The developers could inject the library they are using in their project, and react-datetime would be agnostic. |
https://github.com/jquense/react-big-calendar is an example case where abstracting out moment.js and date-fns works well. I would welcome this library to support a similar pattern. |
It looks like https://github.com/dmtrKovalenko/date-io might work as a wrapper around whichever date library a user chooses. |
We've just released version 3 and we need to start thinking where we are going to with the next version of the library. I'd like to give the opportunity to anyone to collaborate with their code but also with their thoughts about how to make react-datetime better.
React-datetime is an old pal, it was created soon after React.js was published (can you remember React's mixins? react-datetime used them!) and that means that the library's base code was based in old patterns that, nowadays, no developer want to dive in.
So version 3 has been an effort to take react-datetime a bit to the present (we stopped using
createClass
) but the internals are still basically the same, trying to not to break the current API so much.My view of version 4 is in the same direction, I really would like to:
But also I would like to make the code better with features that has been requested for so long:
These points are some objectives I have in mind, but they are not the roadmap for the version 4. This issue is just to let us discuss and define the roadmap together, so feel free to leave your comments with your thoughts!
The text was updated successfully, but these errors were encountered: