Today I Learned

hashrocket A Hashrocket project

Date javascript

Date javascript function on chrome is weird:

new Date('2016-10-3')
Mon Oct 03 2016 00:00:00 GMT-0400 (EDT)
new Date('2016-10-10')
Sun Oct 09 2016 20:00:00 GMT-0400 (EDT)

Why? Anyway, this is my "alternative" approach for that:

new Date('2016-10-10 0:0')
Mon Oct 10 2016 00:00:00 GMT-0400 (EDT)
new Date('2016-10-3 0:0')
Mon Oct 03 2016 00:00:00 GMT-0400 (EDT)
See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.