Skip to content

Commit

Permalink
fix: proper processing of date filters for the RW rivers
Browse files Browse the repository at this point in the history
Refs: RWR-368
  • Loading branch information
orakili committed Sep 26, 2023
1 parent 2b03405 commit 37fd174
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions html/modules/custom/hr_paragraphs/hr_paragraphs.module
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,16 @@ function hr_paragraphs_validate_date_filter_values($code, array $values) {
}
}

// Format the dates to ISO 8601.
if (!empty($dates['from'])) {
$dates['from'] = $dates['from']->format('c');
}
// The `to` date is inclusive, so we add 1 day minus 1 second to the
// `to` date so that we cover the entire day.
if (!empty($dates['to'])) {
$dates['to'] = $dates['to']->modify('+1 day -1 second')->format('c');
}

return $dates;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ public function parseReliefwebUrl(string $url) : array {
}
else {
$conditions[$key] = $condition;
$conditions[$key]['value'] = $condition['processed'] ?? $condition['value'];
}
}
}
Expand Down

0 comments on commit 37fd174

Please sign in to comment.