Skip to content

Commit b7fd9a5

Browse files
Sandro Santillibrianc
Sandro Santilli
authored andcommitted
Do not assume dates with no timezone specifier are UTC
Fixes brianc#225
1 parent 8b9e97f commit b7fd9a5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/textParsers.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ var parseDate = function(isoDate) {
4747
default:
4848
throw new Error("Unidentifed tZone part " + type);
4949
}
50-
}
5150

52-
var utcOffset = Date.UTC(year, month, day, hour, min, seconds, mili);
51+
var utcOffset = Date.UTC(year, month, day, hour, min, seconds, mili);
52+
return new Date(utcOffset - (tzAdjust * 60* 1000));
53+
}
54+
else {
55+
return new Date(year, month, day, hour, min, seconds, mili);
56+
}
5357

54-
var date = new Date(utcOffset - (tzAdjust * 60* 1000));
55-
return date;
5658
};
5759

5860
var parseBool = function(val) {

0 commit comments

Comments
 (0)