Closed elektronikasa closed 5 years ago
I confirm, to disable the 28th and 29th of May (5) I must set: disable: [{ from: [2019,4,28], to: [2019,4,29] }]
This is correct as the month is 0-indexed. This is not a bug.
https://codepen.io/DanielRuf/pen/rgKPwg
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
Given at least a year and month, this form of Date() returns a Date object whose component values (year, month, day, hour, minute, second, and millisecond) all come from the following parameters. Any missing fields are given the lowest possible value (1 for the day and 0 for every other component).
year Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999; all other values are the actual year. > See the example below.
monthIndex Integer value representing the month, beginning with 0 for January to 11 for December.
Closing this one as we do not have a reproducible testcase.
@elektronikasa if you can provide a codepen which shows this issue, please let me know and I will reopen this issue.
I understand the monthIndex explanation, and I thank you for that. If so, anyway, the documentation should be updated. Now I can read something like:
Using arrays formatted as [YEAR,MONTH,DATE]§
$('.datepicker').pickadate({ disable: [ [2015,3,3], [2015,3,12], [2015,3,20] ] })
The values for from & to can be:
A JavaScript Date object,
An array formatted as [YEAR,MONTH,DATE],
And true to set it as “today”.
Which is wrong
Hi @gianlucagiacometti,
what exactly is wrong in the docs?
@gianlucagiacometti we try to emphasize this fact at the very top of the date picker docs: https://amsul.ca/pickadate.js/date/#picker
@gianlucagiacometti we try to emphasize this fact at the very top of the date picker docs:
Exactly.
NOTE: months in a JavaScript Date object are zero-indexed. Meaning, new Date(2016, 3, 20) is 20 April, 2016.
To stay consistent with this, whenever an integer is used in reference to a month, pickadate treats it as zero-indexed. Dates as strings are still parsed as expected.
Ok sorry, my fault. I didn't read carefully the whole documentation and I missed that part.
No problem. We are glad we could help here and you may have now a better understanding of the native Date
API of JavaScript.
Hi There. Im currently trying to disable dates for Noivember 2018 but it seems to disable the dates in the following month (december)
$('.checkin2').pickadate({ disable: [ { from: [2018,12,9], to: [2018,12,15] } ] });