Skip to content

fix(search): Improve date/time expression handling - #8988

Merged
tkaemming merged 2 commits into
masterfrom
search-date-query
Jul 10, 2018
Merged

tkaemming merged 2 commits into
masterfrom
search-date-query

Conversation

@tkaemming

Copy link
Copy Markdown
Contributor
  • Adds support for specifying inclusivity/exclusivity of date expressions.
  • Fixes ISSUE-67 (incorrect handling of datetime values when used in a condition expression.)

@tkaemming
tkaemming requested review from a team July 9, 2018 22:45
return (
None,
(timezone.now() - delta, True),
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making these both inclusive was sort of an arbitrary choice, I can change it if anyone has strong opinions otherwise.

return (
(value - timedelta(minutes=5), True),
(value + timedelta(minutes=6), False),
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumption here is this interval is widened to increase the likelihood of showing results that happened "around that time"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... this... this one hurts my head a bit.

if value[:2] in ('>=', '=>'):
return (parse_datetime_value(value[2:])[0], None)
if value[:2] in ('<=', '=<'):
return (None, parse_datetime_value(value[2:])[0])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The messed up operators here (>=, =<) couldn't actually be hit because they weren't specified in parse_datetime_expression so I removed them.

@tkaemming
tkaemming merged commit 7f8ed80 into master Jul 10, 2018
@tkaemming
tkaemming deleted the search-date-query branch July 10, 2018 20:23
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants