You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add support for BC dates (negative years in ISO 8601) (#12)
Implement parsing and stringification of BC dates using ISO 8601
extended year format with negative year numbers. This follows the
astronomical year numbering system where year 0 = 1 BC, year -1 = 2 BC,
etc.
Changes:
- Parser: Handle optional leading dash before year component
- Stringify: Format negative years with proper padding (e.g., -0044)
- Add comprehensive test coverage for BC dates, including:
- Full dates, year-month, and year-only formats
- Year 0 (1 BC in proleptic Gregorian calendar)
- BC dates with time and timezone components
- Round-trip parsing and stringification
Examples:
- parseTemporal('-0044-03-15') → year: -44 (44 BC)
- parseTemporal('0000-01-01') → year: 0 (1 BC)
- stringifyDate({ year: -44, month: 3, day: 15 }) → '-0044-03-15'
The implementation maintains backward compatibility and follows ISO
8601:2004 extended year format specification.
feat: Add support for BC dates (negative years in ISO 8601)
6
+
7
+
Implement parsing and stringification of BC dates using ISO 8601 extended year format with negative year numbers. This follows the astronomical year numbering system where year 0 = 1 BC, year -1 = 2 BC, etc.
8
+
9
+
**Key features:**
10
+
- Parse BC dates with negative year notation: `-0044-03-15` (44 BC)
11
+
- Support year 0 representing 1 BC: `0000-01-01`
12
+
- Handle BC dates with time and timezone components
0 commit comments