Fixed timezone calculation in initWithString.

This commit is contained in:
Aparajita Fishman
2011-04-08 09:29:45 -04:00
committed by Randall Luecke
parent 2f501ad736
commit e3abd4e407
+2 -2
View File
@@ -110,10 +110,10 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
if (!d || d.length != 10)
[CPException raise:CPInvalidArgumentException
reason:"initWithString: the string must be of YYYY-MM-DD HH:MM:SS ±HHMM format"];
reason:"initWithString: the string must be in YYYY-MM-DD HH:MM:SS ±HHMM format"];
var date = new Date(d[1], d[2] - 1, d[3]),
timeZoneOffset = (Number(d[8]) * 60 + Number(d[9])) * (d[7] === '-' ? -1 : 1);
timeZoneOffset = (Number(d[8]) * 60 + Number(d[9])) * (d[7] === '-' ? 1 : -1);
date.setHours(d[4]);
date.setMinutes(d[5]);