Pass date object array to addDates
Hi,
I passes an array with two date objects to addDates. But it highlighted wrong date. See here: http://jsfiddle.net/rwjbq951/
Bill
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.
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.)
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 (東京 (標準時))