File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
packages/@internationalized/date Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export function parseDate(value: string): CalendarDate {
55
55
1
56
56
) ;
57
57
58
- date . day = parseNumber ( m [ 3 ] , 0 , date . calendar . getDaysInMonth ( date ) ) ;
58
+ date . day = parseNumber ( m [ 3 ] , 1 , date . calendar . getDaysInMonth ( date ) ) ;
59
59
return date as CalendarDate ;
60
60
}
61
61
@@ -194,7 +194,7 @@ export function dateToString(date: CalendarDate): string {
194
194
let gregorianDate = toCalendar ( date , new GregorianCalendar ( ) ) ;
195
195
let year : string ;
196
196
if ( gregorianDate . era === 'BC' ) {
197
- year = gregorianDate . year === 1
197
+ year = gregorianDate . year === 1
198
198
? '0000'
199
199
: '-' + String ( Math . abs ( 1 - gregorianDate . year ) ) . padStart ( 6 , '00' ) ;
200
200
} else {
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ describe('string conversion', function () {
109
109
expect ( ( ) => parseDate ( '2020-13-03' ) ) . toThrow ( ) ;
110
110
expect ( ( ) => parseDate ( '2020-01-32' ) ) . toThrow ( ) ;
111
111
expect ( ( ) => parseDate ( '2020-02-30' ) ) . toThrow ( ) ;
112
+ expect ( ( ) => parseDate ( '2024-01-00' ) ) . toThrow ( ) ;
112
113
} ) ;
113
114
} ) ;
114
115
You can’t perform that action at this time.
0 commit comments