Page 1 of 1

calendar set minDate and maxDate dynamically

Posted: Fri Jul 20, 2018 6:08 pm
by drodriguez
How can i change minDate and maxDate dynamically by javascript?

HTML:
<input id="calendar" type="text" data-role="calendarpicker" data-validate="required" data-size="200px" data-show-header="false" data-show-footer="false" data-format="%d/%m/%Y" data-years-before="0">

I tried:

$('#calendar').data('calendarpicker').setMinDate(2018/07/21');
or
$('#calendar').data('calendarpicker').changeAttribute('data-min-date', '2018/07/21') ;
but nothing happend

changeAttribute of calendarpicker(line 5966 of v4.2.14) has:

changeAttribute: function(attributeName){
switch (attributeName) {
case "value": this.changeValue(); break;
case 'disabled': this.toggleState(); break;
case 'data-locale': this.changeAttrLocale(); break;
case 'data-special': this.changeAttrSpecial(); break;
case 'data-exclude': this.changeAttrExclude(); break;
}
}

changeAttribute must be a "key" , "value" parameters?
example:

changeAttribute: function(attributeName, value){
switch (attributeName) {
.....
case 'data-min-date': this.setMinDate(value); break;
case 'data-max-date': this.setMaxDate(value); break;
}

Thanks

Re: calendar set minDate and maxDate dynamically

Posted: Fri Jul 20, 2018 6:32 pm
by olton
in the current version, you can set dynamically these attributes only for the calendar component.

Re: calendar set minDate and maxDate dynamically

Posted: Fri Jul 20, 2018 6:43 pm
by olton
in 4.2.15:
+ [x] Calendar picker: add observing attributes `data-min-date`, `data-max-date`

wait for the new version. Release on 07/25