ember-datepicker
ember-datepicker copied to clipboard
Feature Request: Allow minDate/maxDate to be bound
Currently the minDate
and maxDate
parameters will only accept a raw Date object. This follows pikaday's functionality but it leaves a lot of potential on the table.
For example, imagine a start and and end date pickers, the end date could have the minDate
bound to the selected start date.
If I have enough time left at the end of this project I'll see if I can put a pull request together but I thought I'd record it here for others in case they also wonder why their date pickers aren't responding to their computed min/max dates.
Thats a great idea.
I'm not sure the component is the right place for this, since there is no cross-component communication. You could utilise your controller to achieve this. Have a controller property that generates the endDate's minDate
based on the selected start date.
On 28 Jan 2015, at 22:33, Kevin Ansfield [email protected] wrote:
Currently the minDate and maxDate parameters will only accept a raw Date object. This follows pikaday's functionality but it leaves a lot of potential on the table.
For example, imagine a start and and end date pickers, the end date could have the minDate bound to the selected start date.
If I have enough time left at the end of this project I'll see if I can put a pull request together but I thought I'd record it here for others in case they also wonder why their date pickers aren't responding to their computed min/max dates.
— Reply to this email directly or view it on GitHub.
You could utilise your controller to achieve this. Have a controller property that generates the endDate's
minDate
based on the selected start date.
This is actually what I tried, however it fails as assigning the CP to the min/maxDate properties simply passed the CP function through. It seemed like the component would need to intercept those properties and pass the pikaday instance the plain date value instead.
I've just found that there is an open issue requesting min/maxDate to accept a function in pikaday's issue tracker: https://github.com/dbushell/Pikaday/issues/165. Obviously that would be the ideal place for the functionality to be implemented.
I'll see if I can work something out over the next few days. If pikaday is slow to respond, would you be open to a pull request that allows bound min/maxDates in the interim?
Could you post some Code? I'm pretty sure that this should be possible.
Does #40 fix this? If so can we get this merged in? Looks like it needs some tests however.