bootstrap-year-calendar
bootstrap-year-calendar copied to clipboard
disableDay
Hi, i catch the array with php of my SQL format "Y,M,D", how use the disableDays? or setDisableDays? from array?
thk
Well this is easier taking in mind that you have the right format there is just one little problem, javascript new date take things with numbers starting from 0 so for example for 0 is January and 1 is Febrary and so on... So, don't know if PHP have a method to extract the month number, put that number on an array and then just do a for each loop or something like this:
--let's fill the year, months, days
foreach var I on ArrayGeneral[]{--This ArrayGeneral[] is the one that you catch with PHP _Year[I] = ArrayYearPart[I]; _Month[I] = ArrayMonthPart[I]; _Day[I] = ArrayDayPart[I]; } and then just do the next
foreach var J in _Day[] { disabledDays: [ new Date (_Year[I], _Month[I] -1, _Day[I]) //the -1 is beacause the thing of the month start from 0 } Maybe not the best, and probably the syntaxis is totally wrong but you get the point, if anything else need it just tell Good luck!
It looks like Date() will accept a raw "microtime" milliseconds since 1 January 1970, so you may want to consider converting to that in php before even passing any conf to the JS lib:
$disabled_date_microtime = strtotime($disabled_date) * 1000;