Skip to content

Commit 85829a9

Browse files
committed
Add initial fix for brianc#156.
TODO: Fix the javascript binary parser too.
1 parent dea80ac commit 85829a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/textParsers.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ var parseDate = function(isoDate) {
88
var match = dateMatcher.exec(isoDate);
99
//could not parse date
1010
if(!match) {
11-
return null;
11+
dateMatcher = /^(\d{4})-(\d{2})-(\d{2})$/;
12+
match = dateMatcher.test(isoDate);
13+
if(!match) {
14+
return null;
15+
} else {
16+
//it is a date in YYYY-MM-DD format
17+
return new Date(isoDate);
18+
}
1219
}
1320
var year = match[1];
1421
var month = parseInt(match[2],10)-1;
@@ -137,6 +144,7 @@ var init = function(register) {
137144
register(700, parseFloat);
138145
register(701, parseFloat);
139146
register(16, parseBool);
147+
register(1082, parseDate);
140148
register(1114, parseDate);
141149
register(1184, parseDate);
142150
register(1005, parseIntegerArray); // _int2

0 commit comments

Comments
 (0)