new Date('2013-06-01')), you’re effectively calling the
The results can be catastrophic when you’re grouping stuff by day and you’re instancing date with just the day component coming as a JSON serialised value like
If you want your dates to behave, always use the constructor that creates dates from int values (e.g.
new Date(2013, 5, 1)). And remember: the month parameter is zero based (0 represents January)!
Visualisation parsing the date with the string constructor (Chrome):
Visualisation parsing the date with the ‘int’ constructor (Chrome):
You can see on the two visualisations above that in Chrome, parsing a date from a string does something extra (probably to do with summer time offset)!