Thursday, June 22, 2017

when newing up a specific date in JavaScript/TypeScript...

var whatever = new Date(1974, 7, 24);

This date is going be August 24th of 1974 and not July 24th of 1974. Remember the goofy zero to eleven scale for month. You have to think of it when it comes to pulling the month back out. Bonus: Also note that .getUTCFullYear(), .getUTCDate(), and .getUTCMonth() are a thing when pulling stuff back out.

No comments:

Post a Comment