fixed bug related to parseInt bug, leading 0 is interpreated in a fucked upp way
This commit is contained in:
parent
ab13d0c1eb
commit
0249d60604
14
lib/query.js
14
lib/query.js
@ -170,15 +170,16 @@ var dateParser = function(isoDate) {
|
||||
var match = dateMatcher.exec(date);
|
||||
var splitDate = date.split('-');
|
||||
var year = match[1];
|
||||
var month = parseInt(match[2])-1;
|
||||
var month = parseInt(match[2],10)-1;
|
||||
var day = match[3];
|
||||
|
||||
var splitTime = time.split(':');
|
||||
var hour = parseInt(splitTime[0]);
|
||||
var min = splitTime[1];
|
||||
var hour = parseInt(splitTime[0],10);
|
||||
var min = parseInt(splitTime[1],10);
|
||||
var end = splitTime[2];
|
||||
var seconds = /(\d{2})/.exec(end);
|
||||
seconds = (seconds ? seconds[1] : 0);
|
||||
seconds = parseInt(seconds,10);
|
||||
var mili = /\.(\d{1,})/.exec(end);
|
||||
mili = mili ? mili[1].slice(0,3) : 0;
|
||||
var tZone = /([Z|+\-])(\d{2})?(\d{2})?/.exec(end);
|
||||
@ -189,10 +190,10 @@ var dateParser = function(isoDate) {
|
||||
switch(type) {
|
||||
case 'Z': break;
|
||||
case '-':
|
||||
tzAdjust = -(((parseInt(tZone[2])*60)+(parseInt(tZone[3]||0))));
|
||||
tzAdjust = -(((parseInt(tZone[2],10)*60)+(parseInt(tZone[3]||0,10))));
|
||||
break;
|
||||
case '+':
|
||||
tzAdjust = (((parseInt(tZone[2])*60)+(parseInt(tZone[3]||0))));
|
||||
tzAdjust = (((parseInt(tZone[2],10)*60)+(parseInt(tZone[3]||0,10))));
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unidentifed tZone part " + type);
|
||||
@ -205,6 +206,9 @@ var dateParser = function(isoDate) {
|
||||
return date;
|
||||
};
|
||||
|
||||
// To help we test dateParser
|
||||
Query.dateParser = dateParser;
|
||||
|
||||
var dataTypeParsers = {
|
||||
20: parseInt,
|
||||
21: parseInt,
|
||||
|
Loading…
Reference in New Issue
Block a user