Skip to content

Commit

Permalink
Merge pull request #644 from UN-OCHA/RW-368
Browse files Browse the repository at this point in the history
[RWR-368] Proper processing of date filters for the RW rivers
  • Loading branch information
attiks authored Sep 28, 2023
2 parents 2b03405 + 37fd174 commit 029c512
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 029c512

Please sign in to comment.