Skip to content

Commit

Permalink
Merge forwardport of #11057 to 2.3-develop branch
Browse files Browse the repository at this point in the history
Applied pull request patch https://github.com/magento/magento2/pull/11057.patch (created by @joachimVT) based on commit(s):
  1. c3ea1f5
  2. 0c0393d
  3. 9fa5ddd

Fixed GitHub Issues in 2.3-develop branch:
  - #6350: Frontend: Datepicker/calendar control does not use the store locale (reported by @heldchen)
  • Loading branch information
magento-engcom-team authored Feb 5, 2018
2 parents 215180d + eafc6f0 commit 685d506
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/code/Magento/Customer/Block/Widget/Dob.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ public function getFieldHtml()
'max_date' => '-1d',
'change_month' => 'true',
'change_year' => 'true',
'show_on' => 'both'
'show_on' => 'both',
'first_day' => $this->getFirstDay()
]);
return $this->dateElement->getHtml();
}
Expand Down Expand Up @@ -304,4 +305,17 @@ public function getMaxDateRange()
}
return null;
}

/**
* Return first day of the week
*
* @return int
*/
public function getFirstDay()
{
return (int)$this->_scopeConfig->getValue(
'general/locale/firstday',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
}
2 changes: 2 additions & 0 deletions lib/internal/Magento/Framework/View/Element/Html/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ protected function _toHtml()
$changeYear = $this->getChangeYear();
$maxDate = $this->getMaxDate();
$showOn = $this->getShowOn();
$firstDay = $this->getFirstDay();

$html .= '<script type="text/javascript">
require(["jquery", "mage/calendar"], function($){
Expand Down Expand Up @@ -59,6 +60,7 @@ protected function _toHtml()
($changeMonth === null ? '' : ', changeMonth: ' . $changeMonth) .
($changeYear === null ? '' : ', changeYear: ' . $changeYear) .
($showOn ? ', showOn: "' . $showOn . '"' : '') .
($firstDay ? ', firstDay: ' . $firstDay : '') .
'})
});
</script>';
Expand Down

0 comments on commit 685d506

Please sign in to comment.