Skip to content

Commit

Permalink
mod_ginger_collection: fix filter on dates before the year 1000 (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
mworrell authored Jul 17, 2023
1 parent 5874c6d commit edda2b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/mod_ginger_collection/support/collection_query.erl
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ map_related_to_property(#triple{}, QueryArgs) ->

date_filter(_Key, _Operator, <<>>, _IncludeMissing) ->
[];
date_filter(Key, Operator, Value, IncludeMissing) when Operator =:= <<"gte">>; Operator =:= <<"gt">>;
date_filter(Key, Operator, Value, IncludeMissing) when
Operator =:= <<"gte">>; Operator =:= <<"gt">>;
Operator =:= <<"lte">>; Operator =:= <<"lt">>
->
DateFilter = [Key, Operator, Value, [{<<"format">>, <<"yyyy">>}]],
% Use "year", as "yyyy" is strict and gives an exception on years < 1000.
DateFilter = [Key, Operator, Value, [{<<"format">>, <<"year">>}]],
OrFilters = case IncludeMissing of
true ->
[DateFilter, [Key, missing]];
Expand Down

0 comments on commit edda2b4

Please sign in to comment.