Skip to content
Snippets Groups Projects
Commit 592c5ffd authored by Jonathan Sacksick's avatar Jonathan Sacksick
Browse files

Issue #3447901 by nsalves: Dashboard metrics form returns wrong date for "This week" filter.

parent 83f462eb
Branches
Tags
No related merge requests found
Pipeline #176877 passed with warnings
......@@ -3,8 +3,8 @@
*/
:root {
--commerce--layout-sidebar-width: 22.5rem;
--commerce--layout-content-max-width: 52rem;
--commerce--layout-sidebar-width: min(960px, 100%);
--commerce--layout-content-max-width: min(1088px, 100%);
}
.layout-region {
......
......@@ -140,6 +140,11 @@ class DashboardMetricsForm extends FormBase {
'month' => new DrupalDateTime('first day of this month'),
'year' => new DrupalDateTime('first day of january this year'),
];
// In case the first day of the week is sunday, the "week" date time object
// can be instantiated for the wrong week.
if ($periods['week'] > $periods['day']){
$periods['week'] = new DrupalDateTime(sprintf('%s last week', $first_day_of_week));
}
$periods = array_map(function (DrupalDateTime $date) use ($active_store) {
$date->setTime(0, 0, 0);
if ($active_store instanceof StoreInterface) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment