Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

[Firefox 3.1] toISOString returns "2008-10-21T15:06:11.324Z" instead of ""2008-10-21T15:06:11.324Z"" #61

Open
geoffreymcgill opened this issue Apr 18, 2015 · 5 comments

Comments

@geoffreymcgill
Copy link
Member

From @GoogleCodeExporter on April 18, 2015 5:51

Note:
This issue relates to a nightly-build of Firefox 3.1, so it may not warrent
any action just yet since it could change again before the actual release
of 3.1. I'm posting it here though just in case though.


What steps will reproduce the problem?
1. Using Firefox 3.1b2pre (>= nightly build for 10-20-2008):
2. var d = new Date();
3. d.toISOString()

What is the expected output? What do you see instead?

expected:
~ ""2008-10-21T15:06:31Z""

see:
~ "2008-10-21T15:06:11.324Z"

What version of the product are you using? On what operating system?
Firefox 3.1b2pre (nightly build for 10-20-2008)

Please provide any additional information below.
This issue only started occurring in 3.1 as far as I know since the
10-20-2008 nightly build. The result of the switch is that some code used
to drop the extra quotation marks (slice(1,-1)) now drops important parts
of the date.

Original issue reported on code.google.com by keith.hu...@gmail.com on 21 Oct 2008 at 3:13

Copied from original issue: #54

@geoffreymcgill
Copy link
Member Author

From @GoogleCodeExporter on April 18, 2015 5:51

Update 2009/06/22: Bug remains as of Firefox 3.5pre.

Original comment by keith.hu...@gmail.com on 22 Jun 2009 at 2:02

@geoffreymcgill
Copy link
Member Author

From @GoogleCodeExporter on April 18, 2015 5:51

I am also seeing this in FF3.5.  Does anyone have a workaround?

Original comment by joey.ski...@gmail.com on 6 Jul 2009 at 9:17

@geoffreymcgill
Copy link
Member Author

From @GoogleCodeExporter on April 18, 2015 5:51

A simple but not-so-elegant work-around is to just check for version 3.1+ of
Firefox,e.g.:

date = myDate.toISOString();
if (navigator.userAgent.search(/3\.[1-9]/) == -1)
    date = date.slice(1, -1);


Original comment by keith.hu...@gmail.com on 7 Jul 2009 at 12:15

@geoffreymcgill
Copy link
Member Author

From @GoogleCodeExporter on April 18, 2015 5:51

Update 2009/07/23:

Webkit also return single-quotes, so it looks like Firefox 3 (and older 
versions?)
are the only ones so far affected by this issue.

A simple solution to deal with either case is to simply remove all any quotation
marks, e.g.

myDate.toISOString().replace(/"/g,'');

If you want to keep one set of quotes:

myDate.toISOString().replace(/""/g,'"');

Any chance of fixing the behavior in Firefox 3.0?

Original comment by keith.hu...@gmail.com on 23 Jul 2009 at 2:41

@geoffreymcgill
Copy link
Member Author

geoffreymcgill commented Apr 18, 2015

From @GoogleCodeExporter on April 18, 2015 5:51

The .toISOString function was based on the JSON.org .toISOString function and 
is only
added by Datejs if the .toISOString function is not available natively. 

I just checked http://www.json.org/json.js (and http://www.json.org/json2.js) 
and it
appears they've once again changed the file and replaced the .toISOString 
function
with .toJSON.

The functionality and return result of .toJSON (formally .toISOString) appears 
to
have changed as well. 

I'm going to have to replace .toISOString. Maybe replace with our own 
.toJsonString()
and just completely avoid the JSON.org and native browser versions.

Original comment by geoff on 29 Jul 2009 at 7:03

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant