(new Date()).toJSON()

J

John G Harris

--> "2010-03-04T16:05:56.319Z"

lovely :)

Please read the FAQ section 1.3, the 'How to Ask a Question' paragraph,
second line. Then tell us what you think of it.

John
 
J

Jorge

Please read the FAQ section 1.3, the 'How to Ask a Question' paragraph,
second line. Then tell us what you think of it.

Why ?
What for ?
That was *not* a question.

Have a nice day, Harrison.
 
D

Dr J R Stockton

In comp.lang.javascript message <c1814492-916b-412f-8cee-1c6aa1f1e6a5@33
g2000yqj.googlegroups.com>, Thu, 4 Mar 2010 08:06:37, Jorge
--> "2010-03-04T16:05:56.319Z"

But with which browser or other agent? None of mine seem to show
fractional seconds.

My Cr4 & SF4 have toJSON & toISOString
My IE8 has toJSON but not toISOString
My FF3.0 & Op10.10 have neither.
 
T

Thomas 'PointedEars' Lahn

Dr said:
[...] Jorge posted:
--> "2010-03-04T16:05:56.319Z"

But with which browser or other agent? None of mine seem to show
fractional seconds.

My Cr4 & SF4 have toJSON & toISOString
My IE8 has toJSON but not toISOString
My FF3.0 & Op10.10 have neither.

I am getting a value in that format in Iceweasel 3.5.8 (Gecko 1.9.1.8).
However, those who have read ES 5, section 15.9.5.44, would probably use

(new Date()).toISOString()

instead of

(new Date()).toJSON()


PointedEars
 
J

Jorge

In comp.lang.javascript message <c1814492-916b-412f-8cee-1c6aa1f1e6a5@33
g2000yqj.googlegroups.com>, Thu, 4 Mar 2010 08:06:37, Jorge


But with which browser or other agent?  None of mine seem to show
fractional seconds.

Webkit r55454.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Dr said:
[...] Jorge posted:
--> "2010-03-04T16:05:56.319Z"

But with which browser or other agent? None of mine seem to show
fractional seconds.

My Cr4 & SF4 have toJSON & toISOString
My IE8 has toJSON but not toISOString
My FF3.0 & Op10.10 have neither.

I am getting a value in that format in Iceweasel 3.5.8 (Gecko 1.9.1.8).
However, those who have read ES 5, section 15.9.5.44, would probably use

(new Date()).toISOString()

instead of

(new Date()).toJSON()


The string is compliant with a small subset of ISO 8601:2004, which you
should have read. ISO 8601 is a small subset of ISO.

The string is probably be compliant with all or nearly all of the
applicable parts of the JSON spec.

Therefore the JSON name is better.

The ES5 people were notified of the inappropriateness of the name
toISOString; the argument was accepted, but too late to be useful.

The Date2 Object will output strings to at least a large subset of
applicable ISO 8601.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn posted:
Dr said:
[...] Jorge posted:
--> "2010-03-04T16:05:56.319Z"

But with which browser or other agent? None of mine seem to show
fractional seconds.

My Cr4 & SF4 have toJSON & toISOString
My IE8 has toJSON but not toISOString
My FF3.0 & Op10.10 have neither.

I am getting a value in that format in Iceweasel 3.5.8 (Gecko 1.9.1.8).
However, those who have read ES 5, section 15.9.5.44, would probably use

(new Date()).toISOString()

instead of

(new Date()).toJSON()

The string is compliant with a small subset of ISO 8601:2004, which you
should have read. ISO 8601 is a small subset of ISO.

It should be obvious that the method of Date instances having `ISO' in
its identifier would pertain to one of the time formats specified in the
corresponding ISO standard.
The string is probably be compliant with all or nearly all of the
applicable parts of the JSON spec.

Therefore the JSON name is better.

You cannot be serious advocating the use of a less efficient wrapper, there
needless, wrapper, only because its "name" would be "better" by some rather
weird interpretation of the meaning of method identifiers.


PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
It should be obvious that the method of Date instances having `ISO' in
its identifier would pertain to one of the time formats specified in the
corresponding ISO standard.

By using "toISOString" we now have uncertainty, and no consistent means
of discriminating between the various date and time formats in 8601.

It needs to be "toISO8601ExtendedCalendarDateAndTime", IIRC, for the
present code.

However, because of the versatility of 8601, date formatting is best
done with a format string, giving individual identifiers only to the
commonest cases of YYYY-MM-DD & hh:mm:ss. The DATE2 Object shows how
that can be done. Given the importance of international standards
outside the USA, the amount of code to implement it within a browser
would not be unreasonable; and non-ISO formats would also be available.

Remember, the authors of ECMA 262-5 are, like yourself, not persons with
any real breadth of knowledge. It seems improbable that many, if any,
of them have actually read ISO 8601.
You cannot be serious advocating the use of a less efficient wrapper, there
needless, wrapper, only because its "name" would be "better" by some rather
weird interpretation of the meaning of method identifiers.

Gobbledegook.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn posted:

By using "toISOString" we now have uncertainty, and no consistent means
of discriminating between the various date and time formats in 8601.

On closer inspection it turns out that the implementors of the
implementations you tested have released implementations that do not comply
with ES 5 (but that may not be their fault, their implementations may have
been ready before ES 5 Final [Draft] was issued; it would help if you
provided more detailed version information):

The format to be used for the return value is explicitly specified in
section 15.9.5.42 by reference to section 15.9.1.15 and the definition that
"All fields are present in the String." This is met by JavaScript 1.8.1 as
of Gecko 1.9.1.8.
It needs to be "toISO8601ExtendedCalendarDateAndTime", IIRC, for the
present code.

Of course not. But the existence of the general method allows for a
parameter that defines the format in the future, which maybe causes a
method as you propose to be called (although I hope someone wiser makes
the choice of method name).
[...]
Remember, the authors of ECMA 262-5 are, like yourself, not persons with
any real breadth of knowledge. It seems improbable that many, if any,
of them have actually read ISO 8601.

"How annoying, all these people are driving in the wrong direction!"
Gobbledegook.

Yes, there was an extra "wrapper" because of rewording. Sorry.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top