fix: support ISO 8601 date, date-time, and 24-hour ranges - #51
Open
Hussein-Abdallah wants to merge 1 commit into
Open
fix: support ISO 8601 date, date-time, and 24-hour ranges#51Hussein-Abdallah wants to merge 1 commit into
Hussein-Abdallah wants to merge 1 commit into
Conversation
Add non-numeric range support restricted to ISO 8601 dates, UTC date-times, and 24-hour times, compared lexically. Only canonical big-endian formats are accepted so lexical order matches chronological order; any other boundary format throws a TypeError, mirroring liqe's existing value-type error. Numeric ranges and all existing behaviour are unchanged. Related to gajus#3
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.
What problem is this PR solving?
liqe only supports numeric range queries (e.g.
height:[100 TO 200]). Any non-numeric boundary fails — an ISO date such ascreated:[2020-01-01 TO 2020-12-31]throws aSyntaxErrorat parse time, and quoted string boundaries are rejected too.This PR adds range support for ISO 8601 dates, UTC date-times, and 24-hour times, so queries like these filter correctly (inclusive
[ ]and exclusive{ }both supported):Quoted boundaries are compared lexically. Only canonical, big-endian formats are accepted — that is the condition under which lexical ordering equals chronological ordering — so any other boundary (free text,
DD-MM-YYYY, timezone offsets, lowercasez, or mismatched precision) throws aTypeError, consistent with liqe's existingExpected a number.value error. Numeric ranges and structuralSyntaxErrors are unchanged.Related to #3 and #8: date and date-time filtering is now possible via ranges; the
:>=/:<=comparison operators shown in #8 are a planned follow-up.What is the impact of this PR?
End users: can now filter by date / date-time / time ranges using the existing range syntax, with the boundaries quoted.
Developers / behaviour change: a string range whose boundaries are not a supported, consistent format now throws a
TypeErrorat filter time (previously such input either failed to parse or matched nothing). Numeric ranges are unaffected, and there is no change to the public API surface (the new validation is internal).Data requirement: lexical comparison equals chronological comparison only for canonical values — single-timezone UTC (
Z), fixed width, big-endian ISO. Non-canonical inputs (12-hour times,DD-MM-YYYY, local offsets) must be normalised before querying.