Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify Date.UTC when called with fewer than two arguments #642

Merged
merged 2 commits into from
Feb 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -25643,7 +25643,7 @@ <h1>Date.prototype</h1>
<!-- es6num="20.3.3.4" -->
<emu-clause id="sec-date.utc">
<h1>Date.UTC ( _year_, _month_ [ , _date_ [ , _hours_ [ , _minutes_ [ , _seconds_ [ , _ms_ ] ] ] ] ] )</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_month_ is optional now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

<p>When the `UTC` function is called with fewer than two arguments, the behaviour is implementation-dependent. When the `UTC` function is called with two to seven arguments, the following steps are taken:</p>
<p>When the `UTC` function is called, the following steps are taken:</p>
<emu-alg>
1. Let _y_ be ? ToNumber(_year_).
1. Let _m_ be ? ToNumber(_month_).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bterlson I just want to confirm this for clarification: we'll have a different behavior for supplied but undefined month. Like the following expected values:

Date.UTC(2016) // 1451606400000
Date.UTC(2016, 0) // 1451606400000
Date.UTC(2016, undefined) // NaN

This will be consistent with the other parameters, but Date.UTC will never be perfect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also consistent with the Date constructor:

new Date(2016, 0) // Fri Jan 01 2016 00:00:00 GMT+0100 (CET)
new Date(2016, undefined) // Invalid Date

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is just how it is :-P

Expand Down