#javascriptMightHaveSomeSmallFlaws
Explore tagged Tumblr posts
Text
JavaScript temporal woes
In Ruby now = Time.now this_time_tomorrow = now + 1.day
In JavaScript var now = new Date() var thisTimeTomorrow = new Date(new Date().setDate(now.getDate() + 1))
o_O
Alternately, I suppose there’s new Date(now + 24 * 60 * 60 * 1000) but that still seems a little ridiculous.
There’s also a Date.now() which is extremely helpful if you want the time in milliseconds since midnight of January 1st, 1970 (UTC), which of course is what we’re all looking for when we want the current time. But hey, maybe ECMA6 will have some new temporal functions that are actually useful?
0 notes