There were two issues here, first is that in Safari on October 2017, when you call startOf('day'), it actually sends you back to September 30th at 8pm (or at least in my timezone - +9:30 GMT). Because of that, when you call hours(12), you are setting the time to 12am on the 30th of September so the calendar actually repeats September. With the use of startOf('day'), we can safely add 12 hours to whatever the date is and it will either be the middle of the day (like good browsers) or will get at least far enough away from causing issues with daylight savings etc (the reason you had the 12 hours there to begin with).
The second issue is that all the hard work for the 12 hours is actually undone with how you do the "today" check. The "day" is mutated back to the start but you only really need to go to the start of the day for that specific if-statement so I cloned the day object specifically for that.
Fixes #134 !
There were two issues here, first is that in Safari on October 2017, when you call
startOf('day')
, it actually sends you back to September 30th at 8pm (or at least in my timezone - +9:30 GMT). Because of that, when you callhours(12)
, you are setting the time to 12am on the 30th of September so the calendar actually repeats September. With the use ofstartOf('day')
, we can safely add 12 hours to whatever the date is and it will either be the middle of the day (like good browsers) or will get at least far enough away from causing issues with daylight savings etc (the reason you had the 12 hours there to begin with).The second issue is that all the hard work for the 12 hours is actually undone with how you do the "today" check. The "day" is mutated back to the start but you only really need to go to the start of the day for that specific if-statement so I cloned the day object specifically for that.