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

parseOffset broken if offset isn't "Z" #2

Open
GoogleCodeExporter opened this issue Apr 24, 2015 · 1 comment
Open

parseOffset broken if offset isn't "Z" #2

GoogleCodeExporter opened this issue Apr 24, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. call format with ISO string with offset ie "+700"
2. when parseOffset is invoked, parseInt expects to see str[0], str[1], etc
3. str isn't an array

What is the expected output? What do you see instead?
Expect parsed date, see NaN instead

What version of the product are you using? On what operating system?
sorry, unknown, got from code repository 7/14/2009 7:00pm PDT
tested in IE7 and IE8

Please provide any additional information below.

solution:

add the following line of code after "var seconds":
  if (str == "Z") { return 0 ; } // UTC, no offset.
  var seconds ;

  //new code, split string into char array
  str=str.split("");  //new code
  //end new code

  seconds = parseInt(str[0] + str[1] + str[2]) * 3600 ; // e.g., "+05" or 
"-08"

Original issue reported on code.google.com by [email protected] on 15 Jul 2009 at 3:53

@GoogleCodeExporter
Copy link
Author

Hi -- sorry I've lost track of this.  I'll add you as a committer to the 
project, and
encourage you to fix this issue and add tests to the unit test suite to prevent
regressions.

Original comment by baron.schwartz on 31 Aug 2009 at 2:25

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

No branches or pull requests

1 participant