File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
scripts/update-browser-releases Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,11 @@ describe('parseReleaseDate', () => {
1212 assert . equal ( result . getUTCMonth ( ) , 2 ) ; // March is 0-indexed as 2
1313 assert . equal ( result . getUTCDate ( ) , 12 ) ;
1414 } ) ;
15+
16+ it ( 'should parse date with full month correctly' , ( ) => {
17+ const result = parseReleaseDate ( '09-April-2026' ) ;
18+ assert . equal ( result . getUTCFullYear ( ) , 2026 ) ;
19+ assert . equal ( result . getUTCMonth ( ) , 3 ) ; // April is 0-indexed as 3
20+ assert . equal ( result . getUTCDate ( ) , 9 ) ;
21+ } ) ;
1522} ) ;
Original file line number Diff line number Diff line change @@ -331,9 +331,8 @@ export const parseReleaseDate = (dateText: string) => {
331331 'Nov' ,
332332 'Dec' ,
333333 ] ;
334- const year = dateText . substring ( 7 , 11 ) ;
335- const month = months . indexOf ( dateText . substring ( 3 , 6 ) ) + 1 ;
336- const day = dateText . substring ( 0 , 2 ) ;
334+ const [ day , monthText , year ] = dateText . split ( '-' ) ;
335+ const month = months . findIndex ( ( m ) => monthText . startsWith ( m ) ) + 1 ;
337336
338337 return new Date ( `${ year } -${ month } -${ day } Z` ) ;
339338} ;
You can’t perform that action at this time.
0 commit comments