bootstrap-year-calendar icon indicating copy to clipboard operation
bootstrap-year-calendar copied to clipboard

disableDay

Open gi-q opened this issue 7 years ago • 2 comments

Hi, i catch the array with php of my SQL format "Y,M,D", how use the disableDays? or setDisableDays? from array?

thk

gi-q avatar Dec 23 '16 12:12 gi-q

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!

William-H-M avatar Dec 23 '16 13:12 William-H-M

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;

ryan-jacobs avatar Aug 07 '17 16:08 ryan-jacobs