ECMA Conformance: missing|Time)String() functions




JavaScript Engine
17 years ago
4 years ago


(Reporter: David Flanagan, Assigned: Mike McCabe)




Firefox Tracking Flags

(Not tracked)


(Whiteboard: [rtm-] fix in trunk)


(1 attachment)



17 years ago
js 1.5 rc2, at least the out-of-date tarball on
does not implement four date methods:

toDateString(), toTimeString(), toLocaleDateString() and toLocaleTimeString().

See ECMA v3 spec, sections to

Note that I am relying on the tarball version of 1.5rc2, which is out
of date and reports the same version number as rc1.

Comment 1

17 years ago
Using JS Engine built 2000-10-25 on WinNT.

I find that in the current code, these methods are in place: 


But these are missing: 


Reassigning to mccabe for Date expertise - 
Assignee: rogerl → mccabe

Comment 2

17 years ago
Here are the ECMA sections: Date.prototype.toDateString ( )
This function returns a string value. The contents of the string are 
implementation-dependent, but are intended to represent the “date” portion 
of the Date in the current time zone in a convenient, human-readable form. Date.prototype.toTimeString ( )
This function returns a string value. The contents of the string are 
implementation-dependent, but are intended to represent the “time” portion 
of the Date in the current time zone in a convenient, human-readable form.

Comment 3

17 years ago
Setting to assigned.

David, would this work as a header for the Date section of your book ?

"For example, OS/360 devotes 26 bytes of the permanently
 resident date-turnover routine to the proper handling of
 December 31 on leap years (when it is Day 366).  That
 might have been left to the operator."

Frederick Brooks, 'The Second-System Effect'.

(from my .plan.)
Ever confirmed: true
Marking for js1.5.  Unless the pdt gets really generous, Netscape 6 will ship 
with js1.4.999 (kidding, but you get the idea).

Keywords: js1.5
mccabe, any chance of a patch soon?  This is one I would go to bat with the pdt
for, to get the number of known ECMA-262 conformance bugs down to trivial ones. 
Fixing summary to reflect pschwartau's findings.

Summary: ECMA Conformance: missing[Locale](Date|Time)String() functions → ECMA Conformance: missing|Time)String() functions

Comment 6

17 years ago
Created attachment 18422 [details] [diff] [review]
add toDateString, toTimeString

Comment 7

17 years ago
Fixes attached, possibly too late ?
Dude, use the CC: box!  Jband, can you sr= so we can get this into the trunk 
and [rtm+] it fast?  There's a Limbo2 round going on today, I think.

Keywords: rtm

Comment 9

17 years ago
sr=jband. Looks good!
mccabe, pls. get this into the trunk; pschwartau, tell us when the testsuite
covers these bad boys.  I'm marking [rtm+] and arguing briefly that these
additions and parameterizations are safe for N6, because they don't break any
existing functions (diff -wu would show that a bit more clearly).  I'll let
mccabe argue further, if the pdt needs more info.

Whiteboard: [rtm+]

Comment 11

17 years ago
Fix in trunk.
Whiteboard: [rtm+] → [rtm+] fix in trunk

Comment 12

17 years ago
rtm-, what real-world pages will be broken by this?  Looks like a good thing to 
get on the trunk though.
Whiteboard: [rtm+] fix in trunk → [rtm-] fix in trunk
This is a standards purity fix, I doubt there are pages outside of firewalls, at 
least pages that don't sniff for IE5.x (whatever rev of IE supports these ECMA 
Edition 3 methods) and serve such method-bearing JS to those clients only.

McCabe, your turn.


Comment 14

17 years ago
Sure, I'll add.

This change is entirely within the JS engine, and just adds two new methods to
the JS object.  All interactions are local,and are limited to one commoned
function.  The commoned function can easily be shown to be equivalent to the old

Zero risk.

David Flanagan is writing a new edition of the O'Reilly JavaScript book, and
he's expressed his sincere wish that he not have to document that Mozilla
doesn't implement the ECMA-262 standard.  These functions are not a behavioral
corner case, but are genuinely useful to developers.
One more try for Netscape 6, based on mccabe's last comment.

Whiteboard: [rtm-] fix in trunk → [rtm+] fix in trunk

Comment 16

17 years ago
As Mike said, these are genuinely useful functions.

And as far as standards compliance goes, you can't get any more
non-compliant than not implementing the API.  You can probably get
away with having a few functions that don't behave quite right
in all cases, but you can't ship Netscape 6 and say it implements
ECMAScript, when it does not even implement the complete API!

Comment 17

17 years ago
rtm-, not ship stopper.
Whiteboard: [rtm+] fix in trunk → [rtm-] fix in trunk

Comment 18

17 years ago
*watches the PDT completely ignore all comments made above*

David: Are you going to at least provide a (textual) link to this bug in your
book when you explain why Netscape 6 isn't compliant?

Comment 19

17 years ago
PDT: There is now an article on OReilly net about how you are not going to fix
this (and many other) standard compliance bugs that you have fixes in hand for.
Your refusal has just gotten much higher profile.

I'm trying to get the URL for this article again (I had it in an e-mail at home).

Comment 20

17 years ago
The URL that jce2 is looking for is

Comment 21

17 years ago
The URL for this article is:

"There is also a high-profile link to the article from the O'Reilly & Associates
home page."

Comment 22

17 years ago
Testcases added to JS test suite for ECMA3 sections to 

           js/tests/ecma_3/Date/ -

Note test is currently failing on Linux; bug 61183 has been filed -
The fix for this is in the trunk.  Should this be marked fixed, or are we
keeping it open for 6.01?

Comment 24

17 years ago
Fix has been checked in to trunk for a while, marking fixed per 6.01 checkin
procedure; still hoping to get it checked in there.
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 25

17 years ago
Verified on Linux, WinNT, and Mac -


4 years ago
Depends on: 888591


4 years ago
No longer depends on: 888591
You need to log in before you can comment on or make changes to this bug.