Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateUtils.parseDateTimeString - month token parsing is too permissive #2102

Closed
bmingles opened this issue Jun 25, 2024 · 0 comments · Fixed by #2092 or deephaven/deephaven-core#5698
Closed
Assignees
Labels
bug Something isn't working

Comments

@bmingles
Copy link
Contributor

We currently parse date time strings for IrisGrid goto row + conditional formatting features in our grids. The backing util is DateUtils.parseDateTimeString.

It uses a RegEx with capture groups to identify date / time tokens:
/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;

And then spreads the matches:

const [
  ,
  year,
  ,
  month, // ([\da-z]+)
  ,
  date,
  ,
  hours,
  ,
  minutes,
  ,
  seconds,
  ,
  nanos,
  overflow,
] = result;

The capture group for the month token is ([\da-z]+) which is presumably intended to match numeric months or some text form of month (maybe 'jan', 'feb', etc.?). This is not documented and the unit test coverage doesn't seem to include any test cases for the string values.

As-is:
2024-04overflow parses to { year: '2012', month: '04overflow' } whereas

2012-04-04overflow parses to { year: '2012', month: '04', date: '20', overflow: 'overflow' }

@bmingles bmingles added bug Something isn't working triage Issue requires triage labels Jun 25, 2024
@bmingles bmingles self-assigned this Jun 25, 2024
@mattrunyon mattrunyon removed the triage Issue requires triage label Jun 27, 2024
mofojed pushed a commit to deephaven/deephaven-core that referenced this issue Jul 4, 2024
Release notes
https://github.com/deephaven/web-client-ui/releases/tag/v0.84.0

### ⚠ BREAKING CHANGES

* - @deephaven/jsapi-components - The contract of
`useSearchableViewportData` to be more consistent with
`useViewportData`. `usePickerWithSelectedValues` now requires
`timeZone`.
- @deephaven/jsapi-utils - `createSearchTextFilter` requires `timeZone`

### Features

* useSearchableViewportData - support non-text filters
([#2092](deephaven/web-client-ui#2092))
([7009e21](deephaven/web-client-ui@7009e21)),
closes [#2102](deephaven/web-client-ui#2102)
[#2091](deephaven/web-client-ui#2091)


### Bug Fixes

* `isElementOfType` Improved type inference
([#2099](deephaven/web-client-ui#2099))
([e13c9d7](deephaven/web-client-ui@e13c9d7)),
closes [#2094](deephaven/web-client-ui#2094)
* Console does not scroll to bottom when code run from notebook
([#2114](deephaven/web-client-ui#2114))
([e75e716](deephaven/web-client-ui@e75e716))
* make textValue default to key for Normalized Item
([#2113](deephaven/web-client-ui#2113))
([bd3e944](deephaven/web-client-ui@bd3e944))
* Update IrisGridContextMenuHandler getHeaderActions return type to be
more permissive
([#2117](deephaven/web-client-ui#2117))
([4e08b79](deephaven/web-client-ui@4e08b79))

Co-authored-by: deephaven-internal <66694643+deephaven-internal@users.noreply.github.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants