Skip to content

Commit

Permalink
updated nanoseconds regex
Browse files Browse the repository at this point in the history
  • Loading branch information
paustint committed Apr 24, 2020
1 parent c0c1c3e commit 133ffd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/parser/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ export const Minus = createToken({ name: 'MINUS', pattern: '-', categories: [Sym

export const DateTime = createToken({
name: 'DATETIME',
pattern: /[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{3})?(\Z|\.[0-9]+Z|\+[0-9]{2}:[0-9]{2}|\-[0-9]{2}:[0-9]{2}|\+[0-9]{4}|\-[0-9]{4})/i,
pattern: /[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(\Z|\.[0-9]+Z|\+[0-9]{2}:[0-9]{2}|\-[0-9]{2}:[0-9]{2}|\+[0-9]{4}|\-[0-9]{4})/i,
categories: [DateIdentifier],
});

Expand Down
10 changes: 8 additions & 2 deletions test/test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1877,12 +1877,18 @@ export const testCases: TestCase[] = [
},
{
testCase: 101,
soql: 'SELECT Id FROM LoginHistory WHERE LoginTime > 2019-04-15T02:40:03.000+0000 AND LoginTime < 2020-04-15T02:40:03.000+0000',
soql:
'SELECT Id FROM LoginHistory WHERE LoginTime > 2020-04-23T09:00:00.00000000000000000000000000000000+00:00 AND LoginTime < 2020-04-15T02:40:03.000+0000',
output: {
fields: [{ type: 'Field', field: 'Id' }],
sObject: 'LoginHistory',
where: {
left: { field: 'LoginTime', operator: '>', value: '2019-04-15T02:40:03.000+0000', literalType: 'DATETIME' },
left: {
field: 'LoginTime',
operator: '>',
value: '2020-04-23T09:00:00.00000000000000000000000000000000+00:00',
literalType: 'DATETIME',
},
operator: 'AND',
right: { left: { field: 'LoginTime', operator: '<', value: '2020-04-15T02:40:03.000+0000', literalType: 'DATETIME' } },
},
Expand Down

0 comments on commit 133ffd7

Please sign in to comment.