Skip to content

Commit

Permalink
Support date instance for temporal oprators
Browse files Browse the repository at this point in the history
  • Loading branch information
ka7eh committed Apr 17, 2023
1 parent 9a2d0ea commit d0d6f1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions pygeofilter/parsers/cql2_json/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def walk_cql_json(node: JsonType): # noqa: C901
float,
int,
bool,
date,
datetime,
values.Geometry,
values.Interval,
Expand Down
16 changes: 15 additions & 1 deletion tests/parsers/cql2_json/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# ------------------------------------------------------------------------------

import json
from datetime import datetime, timedelta
from datetime import date, datetime, timedelta

from dateparser.timezone_parser import StaticTzInfo
from pygeoif import geometry
Expand Down Expand Up @@ -164,6 +164,20 @@ def test_attribute_before():
datetime(2000, 1, 1, 0, 0, 1, tzinfo=StaticTzInfo("Z", timedelta(0))),
)

result = parse(
{
"op": "t_before",
"args": [
{"property": "attr"},
{"date": "2000-01-01"},
],
}
)
assert result == ast.TimeBefore(
ast.Attribute("attr"),
date(2000, 1, 1),
)


def test_attribute_after_dt_dt():
result = parse(
Expand Down

0 comments on commit d0d6f1d

Please sign in to comment.