@@ -28,37 +28,40 @@ LDK.ConvertUtils = new function(){
2828
2929 useStrict = Ext4 . isDefined ( useStrict ) ? useStrict : false ;
3030
31+ // The core of the parsing problem comes from JS Date.parse() treating ISO 8601 short differently from other date formats:
32+ // https://www.w3.org/TR/NOTE-datetime
33+ // Example:
34+ // new Date('2024-01-01')
35+ // Sun Dec 31 2023 16:00:00 GMT-0800 (Pacific Standard Time)
36+ // new Date('1/1/2024')
37+ // Mon Jan 01 2024 00:00:00 GMT-0800 (Pacific Standard Time)
38+ // Therefore special case this format and append the browser's time zone:
39+ if ( format === 'c' && value && value . length === 10 ) {
40+ if ( this . verboseLogging ) {
41+ console . log ( 'switching from c to Y-m-d format' )
42+ }
43+
44+ format = 'Y-m-d' ;
45+ }
46+
3147 if ( Ext4 . Date . formatContainsHourInfo ( format ) ) {
3248 // if parse format contains hour information, no DST adjustment is necessary
3349 result = Ext4 . Date . parse ( value , format , useStrict ) ;
3450 } else {
35- // The core of the parsing problem comes from JS Date.parse() treating ISO 8601 short differently from other date formats:
36- // https://www.w3.org/TR/NOTE-datetime
37- // Example:
38- // new Date('2024-01-01')
39- // Sun Dec 31 2023 16:00:00 GMT-0800 (Pacific Standard Time)
40- // new Date('1/1/2024')
41- // Mon Jan 01 2024 00:00:00 GMT-0800 (Pacific Standard Time)
42-
43- // Therefore special case this format and append the browser's time zone:
44- if ( format === 'c' && value . length === 10 ) {
45- if ( this . verboseLogging ) {
46- console . log ( 'switching from c for Y-m-d format' )
47- }
48-
49- format = 'Y-m-d' ;
50- }
51-
5251 parsedDate = Ext4 . Date . parse ( value , format , useStrict ) ;
5352 if ( parsedDate ) {
5453 result = Ext4 . Date . clearTime ( parsedDate ) ;
5554 }
5655 }
5756
5857 if ( this . verboseLogging ) {
59- console . log ( 'Parsing, raw value: ' + value ) ;
60- console . log ( 'format: ' + format ) ;
61- console . log ( result ) ;
58+ var msg = 'Parsing, raw value: ' + value + ', format: ' + format + ', result: ' + result ;
59+ console . log ( msg ) ;
60+
61+ LDK . Utils . logToServer ( {
62+ level : 'INFO' ,
63+ message : msg
64+ } )
6265 }
6366 return result ;
6467 }
0 commit comments