I am trying to learn javascript by writing my own event calendar, and I ran into a problem.
I do this to check if the date is between the start and end date of the event:
if(thisCellDate > startEventDate && thisCellDate < endEventDate) {}
thisCellDate is the current cell in the grid of days that I'm looping on (days of the current month). The problem is that when the start date is on the same day as the cell in the grid, it does not work, because the cell date is technically earlier.
He is an example of what I'm talking about:
Start Date: Fri May 02 2014 15:01:16 GMT-0400 (Eastern Daylight Time)
Cell Date: Sat May 02 2014 00:00:00 GMT-0400 (Eastern Daylight Time)
End Date: Thu May 29 2014 16:01:24 GMT-0400 (Eastern Daylight Time)
I am generating a Cell date with a date string, for example: new Date('8,8,2014')
Now I thought that I could solve this problem by simply making the cell date as close as possible to the next date as follows: new Date(2013, 8, 8, 23, 59, 59, 999)
, , . ?