Skip to content

Validate that start date precedes end date - #192

Merged
viviant100 merged 2 commits into
podaac:mainfrom
arpitjain099:chore/validate-date-range
Jun 30, 2026
Merged

Validate that start date precedes end date#192
viviant100 merged 2 commits into
podaac:mainfrom
arpitjain099:chore/validate-date-range

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

Right now the start and end dates aren't checked against each other, so if you pass a start date that's later than the end date the bad range just gets sent to CMR and all you see is an HTTP 400, which is pretty confusing. This adds an order check so you get a clear message instead, using the wording suggested in #145. Equal start and end dates are still allowed.

I added a couple of assertions to test_validate covering both the out-of-order case and the equal-dates case. Thanks for taking a look.

The CLI validator parsed --start-date and --end-date for ISO format but
never checked their order, so an inverted range was sent to CMR and the
user only saw an opaque HTTP 400 at request time. Raise a clear error
when start is later than end. Equal dates stay allowed.

Fixes #145

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@viviant100

Copy link
Copy Markdown
Contributor

Thanks for the PR, @arpitjain099, it looks great! The only minor suggestion I'd make is to update the error message to "--end-date must be greater than or equal to --start-date." since the implementation allows equal dates.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099

Copy link
Copy Markdown
Contributor Author

Good catch, thanks. Updated the message to "--end-date must be greater than or equal to --start-date." so it lines up with the equal-dates case being allowed. Pushed to the same branch.

@viviant100
viviant100 merged commit 7ab24f2 into podaac:main Jun 30, 2026
1 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants