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
Dynamically changing minDate/maxDate (date range picker) #20
Comments
@RaZeR-RBI Till we get a fix you may try range mode - |
For some reason I had to put it into the actual html for it to work, but is this what you want @RaZeR-RBI? https://jsfiddle.net/cchejb3p/4/ |
Thanks @Dahje According to vue js API docs
It means the only way to detect change in object properties is to overwrite it. Still need to try with I will dig it more and will add a note. |
Hi there, I'm experiencing this very same problem. It would be very nice to see it fixed soon :) |
As said; Vue.js can not detect changes in Object like this - this.config.minDate = new Date(); One way to do this by overwriting the whole config object this.config = { minDate:new Date() } But this way you will loose existing config properties. The preferred way to to this via this.$set(this.config,'minDate', new Date()) This will just update the One thing to notice here is that - data () {
return {
config : {
onChange: function() {
// i will be lost
}
}
}} then if you do something like this Vue.set(this.config,'minDate', new Date()) you will loose that callback method. |
Thanks for your feedback! Wouldn't it be an idea though to add custom event listeners? |
@TheDiehard22 P.S. |
@ankurk91 Similar question to this one. Is it possible to update the preloaded multiple dates? Lets say I have a dropdown that has a range of days and I want the input to update when a value is selected? ie: Last 7 Days
|
@Minasokoni this.yourModel = '2016-10-10 to 2016-10-20'; |
@ankurk91 lol it was a long day at work. I don't know what I was thinking... Thanks |
i tried to use configs as computed properties but that's not a good idea. |
Hi, any solution to this issue? I just faced a similar problem. I have 2 dates picker, one for StartDate and one for EndDate. So after pick a date and time on Start Date picker, the value will be used as minDate on EndDate Flatpickr. Is that possible? |
@krisnaw
Try this, otherwise i will add example for you. |
Hi @ankurk91, I've tried using an event and changing the config: { minDate: startDate } value of endDate, but I keep getting this error This is my onStartChange method looks like |
onStartChange(selectedDates, dateStr, instance) {
this.$set(this.configs.end, 'minDate', dateStr);
},
onEndChange(selectedDates, dateStr, instance) {
this.$set(this.configs.start, 'maxDate', dateStr);
} You should do like this. |
hi @ankurk91, I still didn't get it working This is my current code looks like
|
<flat-pickr class="form-control" :config="configStartDate" v-model="startDate" @on-change="onStartChange"></flat-pickr>
<flat-pickr class="form-control" :config="configEndDate" v-model="endDate"></flat-pickr> onStartChange(dates, startDate) {
this.$set(this.configEndDate, 'minDate', startDate);
} |
Hi @tychenjiajun I've tried your solution. if I use 'startDate' it will make an error And when I tried using 'this.startDate' referring to v-model data, it doesn't work. I mean the minDate on EndDate flatpickr is not set. Additional information, I'm using
|
@krisnaw |
Wow, thank you very munch @ankurk91. I'll try it now. |
Hi @ankurk91, please respond this tomorrow I've tried the example, but still not working. Here is the full code.
|
@krisnaw |
it doesnt show end date when i select start date and enddate as equal in mode range |
[x] Other, please describe
Not sure if it's a bug or I am using it wrong (sorry for that).
Tell about your platform
Current behavior
Changing minDate and maxDate in the config objects does not trigger component redraw.
Expected behavior
Changing the dates in the fiddle below should update both pickers accordingly to allow proper date range selection (startDate < endDate).
Minimal reproduction of the problem with instructions
JSFiddle
2017-08-29 ~ 2017-08-10
, for example)P.S.: Thank you for creating this component. I was searching for a long time for a good-looking date picker, now the only thing left is getting it to work for me 😃
The text was updated successfully, but these errors were encountered: