File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ const generateConfig: GenerateConfig<Dayjs> = {
162162 parseNoMatchNotice ( ) ;
163163 return null ;
164164 }
165- const date = dayjs ( formatText , format ) . locale ( localeStr ) ;
165+ const date = dayjs ( formatText , format , true ) . locale ( localeStr ) ;
166166 if ( date . isValid ( ) ) {
167167 return date ;
168168 }
Original file line number Diff line number Diff line change @@ -255,4 +255,13 @@ describe('Generate:dayjs', () => {
255255 expect ( timea . isValid ( ) ) . toBeTruthy ( ) ;
256256 expect ( timea . valueOf ( ) ) . toEqual ( timeb . valueOf ( ) ) ;
257257 } ) ;
258+
259+ it ( 'parse' , ( ) => {
260+ const timea = dayjsGenerateConfig . locale . parse ( 'en_US' , '2022-11-23 13:5' , [ 'YYYY-MM-DD HH:mm' ] ) ;
261+ expect ( timea ) . toEqual ( null ) ;
262+
263+ const timeb = dayjsGenerateConfig . locale . parse ( 'en_US' , '2022-11-23 13:05' , [ 'YYYY-MM-DD HH:mm' ] ) ;
264+ const dateb = dayjsGenerateConfig . locale . format ( 'en_US' , timeb , 'YYYY-MM-DD HH:mm' ) ;
265+ expect ( dateb ) . toEqual ( '2022-11-23 13:05' ) ;
266+ } )
258267} ) ;
You can’t perform that action at this time.
0 commit comments