File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,20 @@ class DateTimePicker extends \yii\widgets\InputWidget
77
77
*/
78
78
public $ type = self ::TYPE_DATETIME ;
79
79
80
+ /**
81
+ * @inheritdoc
82
+ */
83
+ public function init ()
84
+ {
85
+ parent ::init ();
86
+ if ($ this ->language === null ) {
87
+ $ this ->language = Yii::$ app ->language ;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @inheritdoc
93
+ */
80
94
public function run ()
81
95
{
82
96
Html::addCssClass ($ this ->options , 'form-control ' );
@@ -146,9 +160,6 @@ protected function registerLanguage($view)
146
160
return ;
147
161
}
148
162
$ language = $ this ->language ;
149
- if ($ language === null ) {
150
- $ language = Yii::$ app ->language ;
151
- }
152
163
153
164
$ language = str_replace ('_ ' , '- ' , strtolower ($ language ));
154
165
@@ -189,7 +200,7 @@ protected function registerFormat()
189
200
} elseif (strncmp ($ format , 'moment: ' , 7 ) === 0 ) {
190
201
$ format = substr ($ format , 7 );
191
202
} else {
192
- $ format = FormatConverter::convertDateIcuToMoment ($ format , $ this ->type );
203
+ $ format = FormatConverter::convertDateIcuToMoment ($ format , $ this ->type , $ this -> language );
193
204
}
194
205
$ this ->clientOptions ['format ' ] = $ format ;
195
206
}
You can’t perform that action at this time.
0 commit comments