diff --git a/app/scripts/components/gql/module.ts b/app/scripts/components/gql/module.ts index 45173474c..186c02d9a 100644 --- a/app/scripts/components/gql/module.ts +++ b/app/scripts/components/gql/module.ts @@ -358,9 +358,11 @@ module ngApp.components.gql { $scope.ddItems = _.filter( GqlService.parseGrammarError($scope.parts.needle, $scope.error), (item: IDdItem): boolean => { - var op: IDdItem = mapping[$scope.parts.op.toLowerCase()] || {}; - if ((op.type || '') === 'long' || (op.full || '').toString().indexOf('datetime') != -1) { + var op: IDdItem = mapping[$scope.parts.op.toLowerCase()] || {}; + if (['long', 'integer'].indexOf(op.type || '') !== -1) { return [T.EQ, T.NE, T.GT, T.GTE, T.LT, T.LTE, T.IS, T.NOT].indexOf(item.full.toString()) != -1 + } else if ((op.full || '').toString().indexOf('datetime') != -1) { + return [T.GT, T.GTE, T.LT, T.LTE, T.IS, T.NOT].indexOf(item.full.toString()) != -1 } else if (op.type === 'string') { return [T.EQ, T.NE, T.IN, T.EXCLUDE, T.IS, T.NOT].indexOf(item.full.toString()) != -1 } else { diff --git a/gql.pegjs b/gql.pegjs index 773781526..58717d6a3 100644 --- a/gql.pegjs +++ b/gql.pegjs @@ -100,7 +100,8 @@ ListExpr } Comparable - = INTEGER + = DATE + / INTEGER Fields = x:Field xs:FieldsRest* { return [x].concat(xs); } @@ -121,6 +122,7 @@ Term "term" = UNQUOTED_STRING / QUOTED_STRING / INTEGER + // Operators GroupOp @@ -142,6 +144,7 @@ CompareOp DIGIT "number" = [0-9] INTEGER = $DIGIT+ REAL = DIGIT* "." DIGIT+ +DASH = "-" COMMA "," = "," COLON ":" = ":" EQUAL "=" = "=" @@ -176,7 +179,11 @@ UNQUOTED_STRING } QUOTED_STRING = DBLQ s:$[^"]+ DBLQ { return s; } - +DATE + = x:(DIGIT DIGIT DIGIT DIGIT DASH DIGIT DIGIT DASH DIGIT DIGIT) + { + return x.join(''); + } // Extra _ = ( WhiteSpace / NewLine )