fix(client): parse word-date values, and seed demo dates that repeat #403

Merged
allan merged 2 commits from fix/va-date-worddate into main 2026-10-29 14:39:40 +00:00
Collaborator

Two changes, both from getting Data Controller to work, and to be visible, inside a Visual Analytics report.

1. Word-date values from VA parameters

A date parameter whose display format is not DATE9 or a numeric date reaches DC as text like January 1, 2026, and the value was being dropped.

Reproduced in a report: a two-parameter report (a value list and a date), date parameter set to January 1, 2026. The editor showed:

FILTER : (( SOME_DROPDOWN = 'Option 1' ))
  • the date clause was missing entirely
  • with no mapping in play there is no banner, so the only clue was the row count
  • window.__vaLastMessage.data confirmed VA was sending the value as January 1, 2026

parseMonthNameDate only matched DATE9 (ddMMM[yy]yy), and parseNumericDate only matches -, / or . separated numbers, so the value fell through both and buildClauseValueSet dropped it.

parseMonthNameDate now accepts a month name spelled out or abbreviated, with the day before or after it, comma optional, with space, - or . after the abbreviation:

Value Clause
January 1, 2026 '01JAN2026'd
Jan 1, 2026 '01JAN2026'd
Jan. 1, 2026 '01JAN2026'd
1 January 2026 '01JAN2026'd
1-Jan-2026 '01JAN2026'd

Month names match on their first three letters, case-insensitively. A month and year with no day (January 2026) is still rejected rather than read as the first of the month - inventing a day would filter on rows the author did not choose.

Scope: date values only. A datetime parameter in this style (January 1, 2026 13:45) is unchanged and still dropped; if that shape turns up it needs its own parse in parseDatetime.

2. Demo data with dates that repeat

The generated rows in mpe_x_test each had a random date, so a date filter over the demo table matched at most a couple of rows - too few to show a date filter working, in a report or in a test. The generated rows now cycle through 24 first-of-month dates over two years (about 20 rows each). The fixed rows at the top of the table are unchanged, and no test asserts a specific generated date.

The variable added to the set list is some_date; some_datetime is still random.

Tests

va-filter.service.spec.ts gains three cases: every accepted shape, the case-insensitive month with DATE9 still parsing, and the month-without-day rejection.

Chrome Headless 153.0.0.0: Executed 55 of 55 SUCCESS
sasjs lint: no new warnings in mpe_makedata.sas

prettier --check clean on both changed client files.

Two changes, both from getting Data Controller to work, and to be visible, inside a Visual Analytics report. ## 1. Word-date values from VA parameters A date parameter whose display format is not DATE9 or a numeric date reaches DC as text like `January 1, 2026`, and the value was being dropped. Reproduced in a report: a two-parameter report (a value list and a date), date parameter set to `January 1, 2026`. The editor showed: ```text FILTER : (( SOME_DROPDOWN = 'Option 1' )) ``` - the date clause was missing entirely - with no mapping in play there is no banner, so the only clue was the row count - `window.__vaLastMessage.data` confirmed VA was sending the value as `January 1, 2026` `parseMonthNameDate` only matched DATE9 (`ddMMM[yy]yy`), and `parseNumericDate` only matches `-`, `/` or `.` separated numbers, so the value fell through both and `buildClauseValueSet` dropped it. `parseMonthNameDate` now accepts a month name spelled out or abbreviated, with the day before or after it, comma optional, with space, `-` or `.` after the abbreviation: | Value | Clause | |---|---| | `January 1, 2026` | `'01JAN2026'd` | | `Jan 1, 2026` | `'01JAN2026'd` | | `Jan. 1, 2026` | `'01JAN2026'd` | | `1 January 2026` | `'01JAN2026'd` | | `1-Jan-2026` | `'01JAN2026'd` | Month names match on their first three letters, case-insensitively. A month and year with no day (`January 2026`) is still rejected rather than read as the first of the month - inventing a day would filter on rows the author did not choose. Scope: date values only. A datetime parameter in this style (`January 1, 2026 13:45`) is unchanged and still dropped; if that shape turns up it needs its own parse in `parseDatetime`. ## 2. Demo data with dates that repeat The generated rows in `mpe_x_test` each had a random date, so a date filter over the demo table matched at most a couple of rows - too few to show a date filter working, in a report or in a test. The generated rows now cycle through 24 first-of-month dates over two years (about 20 rows each). The fixed rows at the top of the table are unchanged, and no test asserts a specific generated date. The variable added to the set list is `some_date`; `some_datetime` is still random. ## Tests `va-filter.service.spec.ts` gains three cases: every accepted shape, the case-insensitive month with DATE9 still parsing, and the month-without-day rejection. ```text Chrome Headless 153.0.0.0: Executed 55 of 55 SUCCESS sasjs lint: no new warnings in mpe_makedata.sas ``` `prettier --check` clean on both changed client files.
hermes added 1 commit 2026-10-29 13:44:00 +00:00
fix(client): parse word-date values from VA parameters
Build / Build-and-ng-test (pull_request) Successful in 3m53s
Lighthouse Checks / lighthouse (pull_request) Successful in 17m17s
Build / Build-and-test-development (pull_request) Failing after 27m2s
ce5b1aa961
A date parameter whose display format is not DATE9 or a numeric date reached
DC as text like "January 1, 2026" and the value was dropped: the clause
builder produced nothing for that parameter, so with no mapping the editor
filtered on the other parameters only, with no banner to say the date had been
ignored. Reproduced inside a report - a SOME_DATE parameter set to
"January 1, 2026" left the FILTER line reading
(( SOME_DROPDOWN = 'Option 1' )) and the grid at the unfiltered row count.

parseMonthNameDate now accepts a month name spelled out or abbreviated, with
the day before or after it, comma optional and "." or "-" as separators, so
WORDDATE-style values ("January 1, 2026", "Jan 1, 2026", "1 January 2026",
"1-Jan-2026") convert like DATE9 does. Only the first three letters of the
month name are matched, case-insensitively.

A month and year with no day ("January 2026") is still rejected rather than
being read as the first of the month - inventing a day would silently filter
on rows the author did not choose.

Unit tests cover each accepted shape, the case-insensitive match, DATE9 still
parsing as before, and the month-without-day rejection.
hermes added 1 commit 2026-10-29 14:05:30 +00:00
test(data): seed the demo table with dates that repeat
Build / Build-and-ng-test (pull_request) Successful in 4m6s
Lighthouse Checks / lighthouse (pull_request) Successful in 17m45s
Build / Build-and-test-development (pull_request) Successful in 26m22s
999e16b8fc
The demo rows had a random date each, so a date filter over the demo table
matched at most a couple of rows - which is not enough to show a date filter
working, in a report or in a test. The generated rows now cycle through 24
first-of-month dates over two years, about 20 rows each.

No test asserts a specific generated date; the fixed rows at the top of the
table are unchanged.
hermes changed title from fix(client): parse word-date values from VA parameters to fix(client): parse word-date values, and seed demo dates that repeat 2026-10-29 14:05:37 +00:00
hermes left a comment
Author
Collaborator

REVIEWED ON 2026-10-29 14:20 UTC

Reviewed the full base...head diff: the word-date parsing in client/src/app/services/va-filter.service.ts, its spec, and the mpe_makedata seed change. The month-first/day-first regexes are anchored, the month lookup is a fixed table with -1 handled, day-less and month-only shapes fall through to null, and the spec covers both orders, comma/abbreviation variants, case-insensitivity, DATE9 regression and the month-only negative case. The seed now produces repeatable first-of-month dates, which is what the date filter needed.

No blocking issues.

REVIEWED ON 2026-10-29 14:20 UTC Reviewed the full base...head diff: the word-date parsing in client/src/app/services/va-filter.service.ts, its spec, and the mpe_makedata seed change. The month-first/day-first regexes are anchored, the month lookup is a fixed table with -1 handled, day-less and month-only shapes fall through to null, and the spec covers both orders, comma/abbreviation variants, case-insensitivity, DATE9 regression and the month-only negative case. The seed now produces repeatable first-of-month dates, which is what the date filter needed. No blocking issues.
allan merged commit 559221fad4 into main 2026-10-29 14:39:40 +00:00
allan deleted branch fix/va-date-worddate 2026-10-29 14:39:40 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/dc#403