Multiple-Dates-Picker-for-jQuery-UI icon indicating copy to clipboard operation
Multiple-Dates-Picker-for-jQuery-UI copied to clipboard

Pass date object array to addDates

Open billzhong opened this issue 10 years ago • 3 comments

Hi,

I passes an array with two date objects to addDates. But it highlighted wrong date. See here: http://jsfiddle.net/rwjbq951/

Bill

billzhong avatar Feb 15 '15 04:02 billzhong

Same issue i am facing. I am passing array of dates to addDates, it is not displaying either date. I have searched enough on google, but no help.

ankul01 avatar Aug 04 '15 12:08 ankul01

Hi guys, I don't know if this can help you, but you can just look at the source code - it is very clean. I noticed it says in the documentation that passing in an array is OPTIONAL but actually it is mandatory (the function expects only arrays, even if it is just one item.)

worthy7 avatar Jul 01 '16 00:07 worthy7

I just tried your code, this is really odd but it honestly looks like a js Date issue. surely not... The month offset starts from 0. Not 1. So your dates are initializing at March 1st and 2nd, not February.

Sure enough it is written here, http://www.w3schools.com/js/js_dates.asp there is a comment in the middle: JavaScript counts months from 0 to 11. January is 0. December is 11.

new Date(2015, 2, 1) Sun Mar 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 0, 1) Thu Jan 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 1, 1) Sun Feb 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 1, 0) Sat Jan 31 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 1, 1) Sun Feb 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 0, 1) Thu Jan 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 1, 1) Sun Feb 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 2, 1) Sun Mar 01 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 2, 15) Sun Mar 15 2015 00:00:00 GMT+0900 (東京 (標準時)) new Date(2015, 1, 15) Sun Feb 15 2015 00:00:00 GMT+0900 (東京 (標準時))

worthy7 avatar Jul 01 '16 00:07 worthy7