Closed enricodeveloper closed 2 years ago
Can you upload your code specifying the options for your datepicker? If customWeekDays is not the last item in the list make sure you have a comma at the end if the line...
Can you upload your code specifying the options for your datepicker? If customWeekDays is not the last item in the list make sure you have a comma at the end if the line...
<input id="cin" type="text" class="custom-select11" name="cin" />
const myDatePicker = MCDatepicker.create({ el: '#cin', autoClose: true, closeOnBlur: true, dateFormat: 'dd/mm/yyyy', minDate: new Date(yyyy, mm, gg), customWeekDays: ['D', 'L', 'M', 'M', 'G', 'V', 'S'], customMonths: [ 'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre' ] })
Thanks,
Can you try by using the full word for each day rather than a single letter? Also have you declared yyyy, mm and gg as variables as minDate needs to refer to a specific date rather than date formatting?
Thanks,
Can you try by using the full word for each day rather than a single letter? Also have you declared yyyy, mm and gg as variables as minDate needs to refer to a specific date rather than date formatting?
I solved. Now I have another problem with minDate: new Date (yyyy, mm, dd),
yyyy = 2022 - mm = 06 - dd = 19
the calendar starts with the following month
Thank you
OK, so that is caused by a peculiarity of how javascript handles dates (see: https://javascript.info/date), so in your example, you could create a string from your variables ie
dateString = yyyy + "-" + mm + "-" + dd;
then use that for your minDate:
minDate: new Date (dateString),
or you could just subtract 1 from your mm value...
OK, so that is caused by a peculiarity of how javascript handles dates (see: https://javascript.info/date), so in your example, you could create a string from your variables ie
dateString = yyyy + "-" + mm + "-" + dd;
then use that for your minDate:minDate: new Date (dateString),
or you could just subtract 1 from your mm value...
Perfect
Thank you :)
If your problem has been solved could you close the issue?
customWeekDays: ['D', 'L', 'M', 'M', 'G', 'V', 'S'] for italian language not work
error: Cannot read properties of undefined (reading 'allowedYears')