@@ -167,38 +167,22 @@ define([
167
167
prepareDateTimeFormats : function ( ) {
168
168
this . pickerDateTimeFormat = this . options . dateFormat ;
169
169
this . momentFormat = this . options . dateFormat ?
170
- this . convertToMomentFormat ( this . options . dateFormat ) : this . momentFormat ;
170
+ utils . convertToMomentFormat ( this . options . dateFormat ) : this . momentFormat ;
171
171
172
172
if ( this . options . showsTime ) {
173
173
this . pickerDateTimeFormat += ' ' + this . options . timeFormat ;
174
174
}
175
175
176
- this . pickerDateTimeFormat = utils . normalizeDate ( this . pickerDateTimeFormat ) ;
176
+ this . pickerDateTimeFormat = utils . convertToMomentFormat ( this . pickerDateTimeFormat ) ;
177
177
178
178
if ( this . dateFormat ) {
179
179
this . inputDateFormat = this . dateFormat ;
180
180
}
181
181
182
- this . inputDateFormat = utils . normalizeDate ( this . inputDateFormat ) ;
183
- this . outputDateFormat = utils . normalizeDate ( this . outputDateFormat ) ;
182
+ this . inputDateFormat = utils . convertToMomentFormat ( this . inputDateFormat ) ;
183
+ this . outputDateFormat = utils . convertToMomentFormat ( this . outputDateFormat ) ;
184
184
185
185
this . validationParams . dateFormat = this . outputDateFormat ;
186
- } ,
187
-
188
- /**
189
- * Converts PHP IntlFormatter format to moment format.
190
- *
191
- * @param {String } format - PHP format
192
- * @returns {String } - moment compatible formatting
193
- */
194
- convertToMomentFormat : function ( format ) {
195
- var newFormat ;
196
-
197
- newFormat = format . replace ( / y y | y / gi, 'YYYY' ) ; // replace the year
198
- newFormat = newFormat . replace ( / d d | d / g, 'DD' ) ; // replace the date
199
- newFormat = newFormat . replace ( / m m | m / gi, 'MM' ) ; //replace the month
200
-
201
- return newFormat ;
202
186
}
203
187
} ) ;
204
188
} ) ;
0 commit comments