This is why a spec is needed. Date.UTC(0) returns the same thing as Date.UTC(undefined) and Date.UTC() in at least Firefox and Chrome. So this is not just about missing arguments; it's about different behavior after you coerce the argument to a number. So what is the actual behavior you're asking us to implement?
Oh, I see, fewer than two arguments, ok.
(In reply to Boris from comment #1) > So what is the actual behavior you're asking us to implement? (In reply to Boris from comment #2) > Oh, I see, fewer than two arguments, ok. I don’t actually have a preference – I’d just like all implementations to align. The simplest way to make that happen is to convince Firefox/SpiderMonkey and IE/Chakra to return `NaN` for `Date.UTC` calls with fewer than two arguments, but if everyone else is willing to change, that’s fine too. The spec bug is here, in case you have a strong opinion: https://bugs.ecmascript.org/show_bug.cgi?id=3112
This is now specced, and we should update our implementation: https://tc39.github.io/ecma262/#sec-date.utc
Created attachment 8837575 [details] [diff] [review] bug1050755.patch This is covered by test262, so I didn't need to write new tests. \o/ I'll update the patch to use the correct git hash as soon as https://github.com/tc39/ecma262/pull/642 is merged.
Comment on attachment 8837575 [details] [diff] [review] bug1050755.patch Review of attachment 8837575 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the patch.
The pull request has been merged.
Created attachment 8841722 [details] [diff] [review] bug1050755.patch Updated patch to apply cleanly on inbound, no functional changes. Carrying r+ from shu.
(In reply to Tom Schuster [:evilpie] from comment #7) > The pull request has been merged. Thanks for pinging bterlson to merge the PR!
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/4db4dc2a4620 Allow to call Date.UTC with fewer than two arguments per ES2017. r=shu