Try replacing react-dates with react-calendar#41385
Conversation
|
Size Change: -30.1 kB (-2%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
|
mmmm! That's not bad. (Ignore the |
|
Thank you @noisysocks for attempting this! The bundle size savings are quite good, it'd be great to land these changes!
Can we embed those styles by referencing them directly from the Also, have we assessed that
We'd need to make sure:
Regarding the switch from
|
|
Agree with all your points! Regarding This was just a little Friday experiment and I don't really have the capacity to work on this right now. If there's a
Yes, this works perfectly. The styles are so straightforward though that I think it might make sense to roll our own from scratch rather than import styles from
No, we should probably investigate some other libraries too. I was drawn to |
I'd looked around for some options for this and I was most intrigued by https://github.com/its-danny/use-lilius. Being hook based it seemed like it would have all the flexibility we could ask for (besides making it quite lightweight). |
|
Just chiming in to make sure folks are aware of the prior attempts to move to date-fns and the eventual revert due to some timezone-related issues: |
|
Looks like Chromium support for Temporal is under active development: |
|
Gecko and WebKit seem to be working on it as well, after looking into this a bit more. Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1519167 |
|
I'd like to add my support to @griffbrad's idea of using Temporal. The proposal is at stage 3, which means it's unlikely to see any major changes, so the API should be pretty final. This means the code we'd write now would likely work unchanged with what ends up shipping in browsers. Using a polyfill for now means that in the worst case scenario we'd need to ship that for a while, and in the best case scenario we'd be able to get rid of it sooner than we expect. That's a strong advantage over a 3rd party library, which we'll always need to ship. In addition, the Temporal spec is pretty extensive, and should cover pretty much every use-case, so functionality-wise I wouldn't expect it to be a problem. That would leave the state of the existing polyfill as the only thing that still needs to be evaluated. The npm page claims it's still not production-ready, but it seems to be pretty far along in the roadmap, with only optimisation work left. Depending on the current state and our needs, it may actually be usable as-is. |
|
Neat!
Doesn't sound implausible that we could start using Temporal now or delay this refactor until Temporal is slightly more stable. It does rule out I'm going to close this out as I don't really have the bandwidth to continue with the exploration right now. If you'd like to pick it up, feel free! |
What?
Quick attempt at replacing
react-dateswithreact-calendar.This is functional but completely unstyled. The CSS for
react-calendaris actually pretty simple. I'm thinking that, instead of overriding styles, we just copy the CSS from there and make it our own.We'd also have to test accessibility. Not sure what the differences there are.
Mostly I'm interested in what this does to the bundle size. If it's a big difference then this is probably worth continuing.
Why?
How?
Testing Instructions
Screenshots or screencast