Skip to content

Commit 9fa5ddd

Browse files
committed
Fix first day of week in dob customer field
1 parent 0c0393d commit 9fa5ddd

File tree

2 files changed

+17
-1
lines changed
  • app/code/Magento/Customer/Block/Widget
  • lib/internal/Magento/Framework/View/Element/Html

2 files changed

+17
-1
lines changed

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ public function getFieldHtml()
186186
'max_date' => '-1d',
187187
'change_month' => 'true',
188188
'change_year' => 'true',
189-
'show_on' => 'both'
189+
'show_on' => 'both',
190+
'first_day' => $this->getFirstDay()
190191
]);
191192
return $this->dateElement->getHtml();
192193
}
@@ -307,4 +308,17 @@ public function getMaxDateRange()
307308
}
308309
return null;
309310
}
311+
312+
/**
313+
* Return first day of the week
314+
*
315+
* @return int
316+
*/
317+
public function getFirstDay()
318+
{
319+
return (int)$this->_scopeConfig->getValue(
320+
'general/locale/firstday',
321+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
322+
);
323+
}
310324
}

lib/internal/Magento/Framework/View/Element/Html/Date.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected function _toHtml()
2626
$changeYear = $this->getChangeYear();
2727
$maxDate = $this->getMaxDate();
2828
$showOn = $this->getShowOn();
29+
$firstDay = $this->getFirstDay();
2930

3031
$html .= '<script type="text/javascript">
3132
require(["jquery", "mage/calendar"], function($){
@@ -59,6 +60,7 @@ protected function _toHtml()
5960
($changeMonth === null ? '' : ', changeMonth: ' . $changeMonth) .
6061
($changeYear === null ? '' : ', changeYear: ' . $changeYear) .
6162
($showOn ? ', showOn: "' . $showOn . '"' : '') .
63+
($firstDay ? ', firstDay: ' . $firstDay : '') .
6264
'})
6365
});
6466
</script>';

0 commit comments

Comments
 (0)