-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Upgrade date picker #335
Upgrade date picker #335
Conversation
Not sure if the https://github.com/Eonasdan/tempus-dominus is the best option we have. It is the major upgrade of our current solution but to me it does not look super up to date... Other options: https://github.com/flatpickr/flatpickr Do you know others? @VincentLanglet |
cb14cc3
to
3ef3e4a
Compare
No, but the two you listed seems nice. About tempus dominus: https://jonathanpeterson.com/posts/state-of-my-picker.html But I kinda like the small flatpickr |
It is because tempus dominus is the same, but with a different name. For some reason it got renamed. |
Could you please rebase your PR and fix merge conflicts? |
3ef3e4a
to
43d93f6
Compare
43d93f6
to
4f4cc48
Compare
Could you please rebase your PR and fix merge conflicts? |
7adbd13
to
5b05981
Compare
7397766
to
445444c
Compare
Will it solve #362 ? |
I don't think so. But well I do not know really |
With my last changes I have solved:
We have still the benefits of lazy laoded code, so only on the pages that have a date picker , it will load the eonasdan library and the date picker controller. This allows us to define a main application that might load N controllers on SonataAdmin (lazy load if we want them, or not. For example the sidebar navigation could be non lazy load because you need it everywhere) and let other sonataBundles add their own controllers without bundling Stimulus or starting another app themselves. If we like this strategy we can proceed to implement all the options on the selected datepicker (eonasdan or flatpickr), this is just a proof of concept to see how the whole system could work. Some things that we might want to address tho:
@VincentLanglet wdyt? we are coupling with Stimulus but to me it does not look like jQuery, it is more modern and allows us to do nice things like lazy load and auto bind when new html is created on the fly, without being to heavy. Another good thing is that the developer could hook on the dispatched event to alter the behavior OR extend our controller and implement its own logic, everything without having to remove the official Sonata javascript. I can provide some example on how this could work too. |
This should be still possible indeed. Does it require to use stimulus ? |
This use yes, similar to the previous requirement of jQuery. |
With some doc, I think it should be ok |
4cef046
to
d24c63d
Compare
cb0f359
to
e34ecb0
Compare
I would love to introduce typescript, but there are things to consider: good things:
bad things:
So, I would like to do it, but not sure if it is a great idea right now. Maybe we shoul do a two step process. First cleanup javascript changing it to stimulus, and next major change to typescript. wdyt @VincentLanglet ? The bad thing about that plan is having 2 majors with big bc breaks due to change from older jquery to stimulus and another from javascript to typescript. |
Yeah would be better to not delay this release too much
Why is it a BC break ? Even if our code is in Typescript, we should still expose a JS endpoint. |
Yes, the normal usage it would still be covered. But if someone wants to compile its own js using our sources it will be a bc break (we might not care for that usage tho) |
I think a minor version with some message in the upgrade note will be enough. We should only cover BC for normal usage |
a575808
to
aa99a5b
Compare
Back to the flatpickr topic, flatpickr allows several options:
One questions about it. Should we support both giving strings and DateTimes? Example:
When you pass a string, you must make sure it is in the same format as With the current implementation, both options are compatible, but you can't mix datetimes and strings in the same picker, like:
So. Should we support strings and DateTimes? and support them at the same time too? or stick with only DateTimes? |
510e12e
to
71cbd57
Compare
If it's not hard to do I would say it simpler to support both. Btw, some normalizers could be refactored since they are the same. |
Could you please rebase your PR and fix merge conflicts? |
9cad8ab
to
77f0975
Compare
Could you please rebase your PR and fix merge conflicts? |
Can't we just deprecate the date picker? There's a good support for native html date picker: https://caniuse.com/?search=date |
Wdyt @VincentLanglet ? it would def simplify things for this bundle, it would also remove some feature like the range date pickers. IMO it would still be nice to add stimulus to SonataAdmin to refactor all the js and simplify a lot of things, but the datepickers can be native. We can try another Pr to see how it would look with native date pickers and try to solve the range pickers with that. |
I don't use sonataAdmin anymore but when I used it we were using the sonata date picker type a lot, even for field which were not in the admin. You can see with issue like sonata-project/SonataDoctrineORMAdminBundle#1662 that some people prefer date picker over classic date form. But I can't say how better is the sonata date picker than the default one |
14c41b8
to
80643d6
Compare
80643d6
to
0b782bc
Compare
Fixed with #427 |
Subject
I am targeting this branch, because this breaks BC..
Closes #320
Changelog