TimePicker - Prevent end before start with JS timepicker
When using the TimePicker, the user shouldn't be able to choose an END time before the START time for an event. I found another thread by @Spârky that gave a great solution, but doesn't work with the JS version (->native(false)). I've played with it but can't find the magic formula to get the Carbon instances to compare properly.
Has anyone got a solution?
Solution:Jump to solution
Thanks for jumping in though! Maybe the casts are important in the timepicker too!
4 Replies
I haven't set native(false) on my form.
The following works without specifying native() or native(false):
Model:
Form:
Oh duh. I just realized you said TIMEpicker, not DatePicker.
Solution
Thanks for jumping in though! Maybe the casts are important in the timepicker too!
Ya, they probably are, since you're trying to treat them as Carbon instances.
If you feel it may be useful to add a note about casts to the docs in relation to using those components, go ahead and PR it. It may save someone else some time. (or, you might have happen what often happens for me, I start working on fixing it in the docs and discover that it was actually there and I'd glossed over it!)