Serhioromano / bootstrap-calendar

Full view calendar with year, month, week and day views based on templates with Twitter Bootstrap.
http://bootstrap-calendar.eivissapp.com/
MIT License
3.02k stars 1.29k forks source link

Year View doesn't show events on the last day of each month (fix suggestion included) #174

Closed jonathanmcc closed 10 years ago

jonathanmcc commented 10 years ago

Year view doesn't show the events on last day of each month due to this line:

t.end = parseInt(new Date(this.options.position.start.getFullYear(), month + 1, 0, 0, 0, 0).getTime());

in the function Calendar.prototype._month

it marks the 00:00:00 of last day of each month as the end of month, which means anything happens that day is not included.

Suggestions:

t.end = parseInt(new Date(this.options.position.start.getFullYear(), month + 1, 0, 23, 59, 59).getTime());

This should do the fix

mlocati commented 10 years ago

it marks the 00:00:00 of last day of each month as the end of month, which means anything happens that day is not included.

I'd disagree: new Date(this.options.position.start.getFullYear(), month + 1, 0, 0, 0, 0) should mark as (exclusive) end the 00:00:00 of the first day of the next month...

jonathanmcc commented 10 years ago

That's what I thought when I saw that line :(

I've added console.log(new Date(this.options.position.start.getFullYear(), month + 1, 0, 0, 0, 0)); in the function, and here is the output when I click the year view:

screen shot 2013-11-11 at 1 20 05 am

mlocati commented 10 years ago

You're right! The correct code should be new Date(this.options.position.start.getFullYear(), month + 1, _1_, 0, 0, 0)

mlocati commented 10 years ago

I fixed the code (see https://github.com/Serhioromano/bootstrap-calendar/commit/bd05e9fb107772945127e65a96088aa82983102d ). Thank you!

jonathanmcc commented 10 years ago

Glad to help :smiley: