Summary
lg fetch/lg sync accepts a start date that is later than the end date because the validation compares isAfter(start, addDays(end, 1)). Adding a day to the end makes ranges where start is exactly one day after end pass the check, so the CLI keeps running instead of rejecting the parameters.
Steps to Reproduce
- Run
node lg.mjs fetch --enrollment fake --start 2024-01-10 --end 2024-01-09.
- Commander parses the options and the process keeps going instead of exiting with the "Invalid range" message.
Expected Result
The CLI should stop immediately with a validation error when start is after end.
Actual Result
The validation is skipped, the API request is attempted, and users get confusing empty results.
Additional Context
This lives in lg.mjs inside normalizeFetchOptions around line 314. Using addDays(end, 1) effectively allows start === end + 1 day. Replacing the check with a direct isAfter(start, end) (and optionally handling invalid ISO strings) would block bad ranges.
Summary
lg fetch/lg syncaccepts a start date that is later than the end date because the validation comparesisAfter(start, addDays(end, 1)). Adding a day to the end makes ranges where start is exactly one day after end pass the check, so the CLI keeps running instead of rejecting the parameters.Steps to Reproduce
node lg.mjs fetch --enrollment fake --start 2024-01-10 --end 2024-01-09.Expected Result
The CLI should stop immediately with a validation error when
startis afterend.Actual Result
The validation is skipped, the API request is attempted, and users get confusing empty results.
Additional Context
This lives in
lg.mjsinsidenormalizeFetchOptionsaround line 314. UsingaddDays(end, 1)effectively allowsstart === end + 1 day. Replacing the check with a directisAfter(start, end)(and optionally handling invalid ISO strings) would block bad ranges.