Topic: Datepicker min and max date?

TimTim pro asked 6 years ago


Hi. how to set the max date, different for each field (with different IDs)! id="date1", id="date2", id="date3".... And, how to change the max date without reloading the page. Thank!

Mikołaj Smoleński staff answered 6 years ago


Hi Tim, Sorry for the misunderstanding. I prepared another example that shows how to reload datepicker without refreshing the page:
<div class="md-form">
 <input placeholder="Selected date" type="text" id="date-picker-example" class="form-control datepicker">
 <label for="date-picker-example">Try me...</label>
</div>
<button class="btn btn-primary change-date">Change max date</button>
$('.datepicker').pickadate();
var picker = $('.datepicker').pickadate('picker');
picker.set('max', new Date(2018,4,14));
$('.change-date').on('click', function() {
 picker.set('max', new Date(2018,4,25));
})
Regards

TimTim pro commented 6 years ago

Thanks so much!

Mikołaj Smoleński staff answered 6 years ago


Hi Tim, I've prepared a code for You, which is solving Your issue with different datepicker fields:
<div class="md-form">
 <input placeholder="Selected date" type="text" id="date-picker-example" class="form-control datepicker">
 <label for="date-picker-example">Try me...</label>
</div>
<div class="md-form">
 <input placeholder="Selected date" type="text" id="date-picker-example2" class="form-control datepicker2">
 <label for="date-picker-example">Try me...</label>
</div>
Regards

TimTim pro commented 6 years ago

You misunderstood me! I do so. $ ('#date1'). pickadate ({ max: new Date (2018,5,14) }); This only works when the page loads. After assembling the page, this property does not change. How do I rebuild (change this property) without reloading the page? Thank you!


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags