From e3abd4e40779d302b7bb810b987ed2fed4febacc Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Fri, 8 Apr 2011 08:35:13 -0400 Subject: [PATCH] Fixed timezone calculation in initWithString. --- Foundation/CPDate.j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Foundation/CPDate.j b/Foundation/CPDate.j index 0e3564135..3d4d12915 100644 --- a/Foundation/CPDate.j +++ b/Foundation/CPDate.j @@ -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]);