-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
React DayPicker 8 #942
Comments
This comment has been minimized.
This comment has been minimized.
Will there be a |
@KyorCode please give a look: https://rdp-v8.netlify.com/docs/input For sure, |
The reason I chose this library is because it doesn't force the consumer to use a specific date/time library (we use Luxon). I'm not a fan of |
@gpbl My use case went out of the window after some talking to the design team. They wanted to have a single input field for a date-range-picker which in practice disables the user from input unless we use a mask or some sort. So we split up the range into two separate inputfields and problem solved :) @milesj We too did pick this library over others because it had no dependency on any date/time library. The localUtils worked great for us, really sad to see them go actually. |
The library is going through an overhaul and one of the changes is that it is going to have a dependency on |
Wow thanks for the feedback! Finally someone rising a voice :) At the time I wrote the component, there was no date-fns, and moment was the only option. Since I did not want to lock people using it, I decided to write my own date utilities – and i tell you it has been a nightmare and a waste of time. Now we can include date-fns in the package without the issues we had with moment, and rely on the amazing solid work of other people.
I think remove the |
@gpbl A few things.
|
Many :) Locales, timezones, etc. I don't want to deal with this things anymore. Maybe exposing date utilities API as wrapper to native date-fns would work. I'd appreciate some help implementing it: <DayPicker
dateFns={{
isToday: day => day.getDate() === new Date().getDate()
}}
/> As alternative a babel-plugin or a webpack resolver would work too! |
Yeah possibly. Do you have a list of all the datetime methods that would be necessary? Another option would be to turn this into a monorepo, where additional packages are all the datetime adapters. |
Not many methods, but few of them are tricky (like the number of the week according to locales). https://github.com/gpbl/react-day-picker/search?l=TypeScript&q=date-fns but really what is the difference including own-written utilities, or those from another package? What are the main concerns? Maybe the locale object being too big? |
People don't want 2 date/lib in their bunlde. |
So, if not a peer dependency, then an internal dependency would make everybody happy? |
No, because it would still end up in the bundle. |
So, let say we continue with our own, internal utilities – like in the v7. No external date lib. Now, such utilities are becoming good enough to stay in their own package, let say Why this solution would be different? What is the actual problem of including a dependency? Size is not, stability either. So what? |
@denisborovikov @gpbl seems like the core library itself + the adapters make it not very slim. It would probably be better to depend on something like Not saying this is a bad library, I just don't see the major benefit it gives over using |
@bengry I think it makes sense to check the real numbers before making a decision. date-io/core is only 100 LOC, any adapter is around 300 LOC. date-fns is 79.3kB minimized, but of course, it depends on how many functions react-day-picker uses. |
@denisborovikov bundlephobia wasn't able to analyze @date-io/core. Looking at the code it seems like it doesn't have any runtime by itself and only includes |
@bengry Not sure I understand your point. react-day-picker doesn't have to include any date libraries. Here's an example of the library, that already uses it. You have to pass an adapter instance through the context. If your project already uses moment.js, it's your project's problem if it's tree-shakeable or not, and you probably already resolved this issue or can deal with it. |
@denisborovikov if a project uses moment.js then they add 4.1kB to their minified bundle (before gzip). That's the easier case though. If a project uses date-fns, they add 5.9kB to their minified bundle, plus functions that neither them nor react-day-picker may need. For example, since date-io has a The P.S. To sum things up, I prefer to keep this (and any other) libraries clean from dependencies. The abstraction that date-io adds is nice in theory, and if this were a backend project maybe I wouldn't care that much about the bundle size, but keeping things lean in frontend packages is very important, in my opinion at least. That is not to say that you shouldn't have dependencies in it, but I hope I managed to get my point across. LMK if there are still misunderstandings or I wasn't clear about something. |
@bangry thanks for your time ! Appreciate the comment. I don’t want to spam the subscribers here - I've opened an issue #980. There are many ways to keep the package size small - is my design constraint - but I won’t write any date utility anymore- it’s ton of demotivating work :) There’re other interesting design decisions to take. Eg i want to remove the idea of “modifiers” - this is a old heritage of the CSS BOM syntax I was using years ago. WTF is a modifier? How do i name this type? - and so on. Why not a more declarative way? I need also help with docs, code reviews, issues triaging... so i can keep working on the code :) Is donating a way to motivate people enough? Not sure i like these things in OSS, where to me motivation is the challenge of writing good code / DX, learning new stuff - without the constraints of work hours or schedules. |
@gpbl Please do edit your comment with a link to the issue once opened, I'll be happy to continue the discussion there. I also agree maintaining the date utilities part of this library is tedious, and also very error-prone. Dates are nothing to take for granted, especially on the web, and libraries like moment or date-fns are popular for a good reason. Regarding the other things you raised, like modifiers etc. - these are all things worthy of their own discussion IMO. I like the idea of modifiers, I just think that tying it to the CSS class names is the issue. We use CSS Modules in our project, and although things work fine, there are broken things because of it (e.g. #959). I suggest maybe opening issues for each respective aspect of v8, and maybe grouping them via a milestone so it's easier to discuss things separately. I'd be happy to take part in some of these, and maybe contribute some code as well, if it's something you're open to. |
Thanks @bengry, I'm setting up a project here: https://github.com/gpbl/react-day-picker/projects/7, issue about date-library is here: #980 |
@gpbl Why tslint instead of eslint? As you may know TSLint is deprecated. |
Do you intend to put hour and minute adjustments in v8? |
@samuelramox this is a feature request I got many times, definitely we should evaluate to add it – not in the first release tho. |
Good news everybody! I could publish a first alpha version on npm: yarn add react-day-picker@next
I'd love someone helping me, as I will be busy in the next weeks.
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
v8 will be a TypeScript rewrite and will introduce some major, needed changes.
Testing v8
Add the next version to the dependencies:
v8 Objectives
DayPickerInput
with a more flexible alternative, e.g. an hook.peer dependencyNotes
DayPickerInput
seems very popular and removing it can make difficult the upgrade.Please help 🙏🏾
With more than 1M download per month, react-day-picker needs love
It is time consuming to work alone on this project, organize the repository, write documentation, the functional tests, and the upgrade guides (not native speaker here).
Please help, talk on https://spectrum.chat/react-day-picker
I started this project five years ago as a way to contribute to the awesome React community. I've learnt a lot, I had a lot of fun, and met the best developers thanks to it.
However, after all these years, the old codebase is not much fun to maintain and after so many changes, the code is not as good as it should. Developers started filling issues on Github, and the glorious OSS experience I had so far hit me to the point I didn't want to read Github notifications anymore.
Surprisingly tho, downloads never stopped to grow and this library is still popular! People continue to send PRs, and some even wrote me that it would be sad to see this library to die. These nice messages have been highly motivational so I'm here again ❤️
The text was updated successfully, but these errors were encountered: