cancel
Showing results for 
Search instead for 
Did you mean: 

Calendar date picker, how not to close on day?

Calendar date picker, how not to close on day?

Requesting a customer to enter their birthdate or the birthdate of a loved one and using the calendar widget we find that users are complaining that the calendar closes before they select a year.

 

Code is below but in the use if you select the fields in the order on screen, pick a month and then the day the input interface will close before you select the year. Is there a way to change this behavior, such as only close when focus is lost? Or only close if the close button is hit?

 

<input id="birth-date" class="input-text" style="width: auto;" name="birth-date" type="text">

<script>
require([
'jquery',
'mage/translate',
'mage/calendar'
], function ($, $t) {
$('#birth-date').calendar({
maxDate: "-1",
buttonImage: "/images/datepicker.gif",
showOn: "both",
minDate: new Date(1900, 1 - 1, 1),
changeMonth: true,
changeYear: true,
showWeek: false,
yearRange: "1900:2030",
});
})

</script>