archives

« Bugzilla Issues Index

#295 — The definitions of Date.prototype.valueOf and Data.prototype.getTime seem inconsistent



I'm not entirely sure where the description submitted previously went - it does not seem to have been attached in any part of this page (including in the 'comment' from me below).

For the sake of completeness, here's a duplicate:


In 15.9.5, it states that: "... the phrase ―this time value‖ refers
to the Number value for the time represented by this Date object, that is, the value of the [[PrimitiveValue]]
internal property of this Date object."

With this in mind, the definitions of getTime and valueOf seem to be functionally identical:

15.9.5.8 Date.prototype.valueOf ( )
The valueOf function returns a Number, which is this time value.

15.9.5.9 Date.prototype.getTime ( )
1. Return this time value.


Since `this time value` is already a Number, isn't the phrasing of Date.prototype.valueOf unnecessary? If I'm correct, maybe it would be better to have:


15.9.5.8 Date.prototype.valueOf ( )
1. Return this time value.

15.9.5.9 Date.prototype.getTime ( )
1. Return this time value.

OR

15.9.5.8 Date.prototype.valueOf ( )
1. Return this time value.

15.9.5.9 Date.prototype.getTime ( )
Alias of Date.prototype.valueOf


Fixed in ES2016 Draft