File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ dateLocalization.inject({
195195
196196 var formatter ;
197197
198- if ( dxVersion >= '17.2.4' && format && typeof dateString === 'string' ) {
198+ if ( dxVersion >= '17.2.4' && format && ! format . parser && typeof dateString === 'string' ) {
199199 dateString = normalizeMonth ( dateString ) ;
200200 formatter = function ( date ) {
201201 return normalizeMonth ( dateLocalization . format ( date , format ) ) ;
Original file line number Diff line number Diff line change @@ -328,6 +328,17 @@ locales.forEach(function(localeId) {
328328 assert . equal ( dateLocalization . parse ( '' , 'shortDate' ) , undefined ) ;
329329 } ) ;
330330
331+ QUnit . test ( 'parse by a function' , function ( assert ) {
332+ var expectedDate = new Date ( 2018 , 1 , 1 ) ;
333+ var customDateString = 'Custom date string' ;
334+ var customParser = function ( text ) {
335+ if ( text === customDateString ) {
336+ return expectedDate ;
337+ }
338+ } ;
339+ assert . equal ( dateLocalization . parse ( customDateString , { parser : customParser } ) . toString ( ) , expectedDate . toString ( ) ) ;
340+ } ) ;
341+
331342 QUnit . test ( 'DevExtreme format uses default locale options' , function ( assert ) {
332343 var date = new Date ( ) ;
333344
You can’t perform that action at this time.
0 commit comments