fixed problem with new parseISO8601 modifications with DST when ignoreTimezone is set to true

This commit is contained in:
Adam Shaw 2010-09-26 18:12:59 -07:00
parent 1d93c56700
commit f1251cd0ba

View file

@ -166,14 +166,18 @@ function parseISO8601(s, ignoreTimezone) {
if (!m) { if (!m) {
return null; return null;
} }
var date = new Date(m[1], 0, 1), offset = 0; var date = new Date(m[1], 0, 1);
if (ignoreTimezone) { if (ignoreTimezone) {
var check = new Date(m[1], 0, 1, 9, 0);
if (m[3]) { if (m[3]) {
date.setMonth(m[3] - 1); date.setMonth(m[3] - 1);
check.setMonth(m[3] - 1);
} }
if (m[5]) { if (m[5]) {
date.setDate(m[5]); date.setDate(m[5]);
check.setDate(m[5]);
} }
fixDate(date, check);
if (m[7]) { if (m[7]) {
date.setHours(m[7]); date.setHours(m[7]);
} }
@ -186,7 +190,9 @@ function parseISO8601(s, ignoreTimezone) {
if (m[12]) { if (m[12]) {
date.setMilliseconds(Number("0." + m[12]) * 1000); date.setMilliseconds(Number("0." + m[12]) * 1000);
} }
fixDate(date, check);
}else{ }else{
var offset = 0;
date.setUTCFullYear(m[1]); date.setUTCFullYear(m[1]);
if (m[3]) { if (m[3]) {
date.setUTCMonth(m[3] - 1); date.setUTCMonth(m[3] - 1);