50 \
Magento\Framework\Stdlib\DateTime\DateTime $date,
52 \
Magento\Framework\Locale\ResolverInterface $localeResolver,
57 $this->_localeResolver = $localeResolver;
58 parent::__construct($context,
$data);
68 $localeData = (
new DataBundle())->
get($this->_localeResolver->getLocale());
71 $daysData = $localeData[
'calendar'][
'gregorian'][
'dayNames'];
75 'wide' => $this->encoder->encode(array_values(iterator_to_array($daysData[
'format'][
'wide']))),
76 'abbreviated' => $this->encoder->encode(
77 array_values(iterator_to_array($daysData[
'format'][
'abbreviated']))
94 $monthsData = $localeData[
'calendar'][
'gregorian'][
'monthNames'];
98 'wide' => $this->encoder->encode(array_values(iterator_to_array($monthsData[
'format'][
'wide']))),
99 'abbreviated' => $this->encoder->encode(
102 null !== $monthsData->get(
'format')->get(
'abbreviated')
103 ? $monthsData[
'format'][
'abbreviated']
104 : $monthsData[
'format'][
'wide']
112 $this->
assign(
'today', $this->encoder->encode($localeData[
'fields'][
'day'][
'relative'][
'0']));
113 $this->
assign(
'week', $this->encoder->encode($localeData[
'fields'][
'week'][
'dn']));
116 $this->
assign(
'am', $this->encoder->encode($localeData[
'calendar'][
'gregorian'][
'AmPmMarkers'][
'0']));
117 $this->
assign(
'pm', $this->encoder->encode($localeData[
'calendar'][
'gregorian'][
'AmPmMarkers'][
'1']));
122 (
int)$this->_scopeConfig->getValue(
123 'general/locale/firstday',
124 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
129 $this->encoder->encode(
130 (
string)$this->_scopeConfig->getValue(
131 'general/locale/weekend',
132 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
140 $this->encoder->encode(
141 $this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM)
146 $this->encoder->encode(
147 $this->_localeDate->getDateFormat(\IntlDateFormatter::LONG)
152 $englishMonths = (
new DataBundle())->
get(
'en_US')[
'calendar'][
'gregorian'][
'monthNames'];
153 $enUS = new \stdClass();
154 $enUS->m = new \stdClass();
155 $enUS->m->wide = array_values(iterator_to_array($englishMonths[
'format'][
'wide']));
156 $enUS->m->abbr = array_values(iterator_to_array($englishMonths[
'format'][
'abbreviated']));
157 $this->
assign(
'enUS', $this->encoder->encode($enUS));
159 return parent::_toHtml();
169 return $this->_date->getGmtOffset();
180 return $this->_localeDate->scopeTimeStamp(
$store);
190 return (
new \DateTime())->modify(
'- 100 years')->format(
'Y')
191 .
':' . (new \DateTime())->modify(
'+ 100 years')->format(
'Y');
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Stdlib\DateTime\DateTime $date, \Magento\Framework\Json\EncoderInterface $encoder, \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data=[])
assign($key, $value=null)
getStoreTimestamp($store=null)
getTimezoneOffsetSeconds()