Skip to content

Commit

Permalink
Handling additional space + text
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Mar 2, 2023
1 parent 0b98b7d commit a332ccf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('isDateConditionValid', () => {
'2023-02-23T00:00:00 NY',
'2023-02-23 NY',
],
invalid: ['blah', '2023-02-23'],
invalid: ['blah', '2023-02-23', '2023-02-23T00:00:00 NY blah'],
empty: '',
undefined,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,10 @@ export function isDateConditionValid(condition: DateCondition, value?: string) {
return true;

default: {
const [dateTimeString, tzCode] = (value ?? '').split(' ');
const [dateTimeString, ...rest] = (value ?? '').split(' ');
// Reconstitute all tokens after the first ' ' in case the user included garbage data at the end
// e.g. '2020-01-01 NY blah'
const tzCode = rest.join(' ');

try {
DateUtils.parseDateTimeString(dateTimeString);
Expand Down

0 comments on commit a332ccf

Please sign in to comment.