Skip to content

Commit

Permalink
[jdbc] Fix date filter to be inclusive (Derby) (openhab#13850)
Browse files Browse the repository at this point in the history
Fixes openhab#9906

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
  • Loading branch information
jlaur authored and psmedley committed Feb 23, 2023
1 parent 5adf20e commit 3287d42
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ protected String histItemFilterQueryProvider(FilterCriteria filter, int numberDe
String filterString = "";
if (filter.getBeginDate() != null) {
filterString += filterString.isEmpty() ? " WHERE" : " AND";
filterString += " TIME>'" + JDBC_DATE_FORMAT.format(filter.getBeginDate().withZoneSameInstant(timeZone))
filterString += " TIME>='" + JDBC_DATE_FORMAT.format(filter.getBeginDate().withZoneSameInstant(timeZone))
+ "'";
}
if (filter.getEndDate() != null) {
filterString += filterString.isEmpty() ? " WHERE" : " AND";
filterString += " TIME<'" + JDBC_DATE_FORMAT.format(filter.getEndDate().withZoneSameInstant(timeZone))
filterString += " TIME<='" + JDBC_DATE_FORMAT.format(filter.getEndDate().withZoneSameInstant(timeZone))
+ "'";
}
filterString += (filter.getOrdering() == Ordering.ASCENDING) ? " ORDER BY time ASC" : " ORDER BY time DESC";
Expand Down

0 comments on commit 3287d42

Please sign in to comment.