Handle ambiguity in --min-date and --max-date#1914
Draft
victorlin wants to merge 2 commits intovictorlin/detect-missing-datefrom
Draft
Handle ambiguity in --min-date and --max-date#1914victorlin wants to merge 2 commits intovictorlin/detect-missing-datefrom
victorlin wants to merge 2 commits intovictorlin/detect-missing-datefrom
Conversation
This puts the function on par with numeric_date() for string types.
This fixes a bug where incomplete dates such as --max-date 2018 would not be inclusive, since that had previously resolved to --max-date 2018-01-01. numeric_date() and get_numerical_date_from_value() are two separate functions that serve similar purposes: converting some date value to a numeric date. The latter has had more recent developments, and crucially will return a date range for ambiguous dates. This is desired for min/max date filters, so I've switched to it.
victorlin
commented
Oct 22, 2025
Member
Author
There was a problem hiding this comment.
Some test matrix jobs are failing at tests/filter/test_relative_dates.py:
tests/filter/test_relative_dates.py:152: in test_filter_relative_dates
assert output_sorted == output_sorted_expected
E AssertionError: assert ['SEQ_1', 'SEQ_2', 'SEQ_3'] == ['SEQ_2', 'SEQ_3']
E
E At index 0 diff: 'SEQ_1' != 'SEQ_2'
E Left contains one more item: 'SEQ_3'
E
E Full diff:
E [
E + 'SEQ_1',
E 'SEQ_2',
E 'SEQ_3',
E ]
argparse_params = '--min-date 1D'
…
================== 6 failed, 569 passed, 2 warnings in 14.95s ==================
This needs investigating. To narrow things down a bit, I noticed it happens in test (python=3.10 biopython=1.80 numpy=latest) and not test (python=3.10 biopython=1.80 numpy=1.26.4). I'm unable to reproduce locally with (python=3.13 biopython=1.85 numpy=2.3.2), so it's not just the numpy version.
(unrelated to this file, just needed to start a thread)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Based on #1913
Description of proposed changes
This fixes a bug where incomplete dates such as --max-date 2018 would not be inclusive, since that had previously resolved to --max-date 2018-01-01.
numeric_date() and get_numerical_date_from_value() are two separate functions that serve similar purposes: converting some date value to a numeric date. The latter has had more recent developments, and crucially will return a date range for ambiguous dates. This is desired for min/max date filters, so I've switched to it.
Related issue(s)
Closes #893
Checklist