@@ -44,6 +44,34 @@ use crate::{
4444use icu_calendar:: { Date as IcuDate , Iso } ;
4545use num_traits:: { cast:: FromPrimitive , Euclid } ;
4646
47+ // ISO/Temporal specification limits
48+ //
49+ // Year limits are defined by the ECMAScript Temporal specification:
50+ // https://tc39.es/proposal-temporal/#sec-temporal-date-objects
51+ // These limits ensure compatibility with ISO 8601 extended year format
52+ // and avoid issues with JavaScript's Date object limitations.
53+ //
54+ // Time component limits follow ISO 8601 standard:
55+ // https://www.iso.org/iso-8601-date-and-time-format.html
56+ // See also RFC 3339: https://tools.ietf.org/html/rfc3339
57+
58+ /// Minimum supported year (-271821-04-19T00:00:00Z corresponds to ECMAScript's minimum time value)
59+ pub ( crate ) const MIN_ISO_YEAR : i32 = -271821 ;
60+ /// Maximum supported year (275760-09-13T00:00:00Z corresponds to ECMAScript's maximum time value)
61+ pub ( crate ) const MAX_ISO_YEAR : i32 = 275760 ;
62+ /// Minimum month value per ISO 8601
63+ pub ( crate ) const MIN_ISO_MONTH : u8 = 1 ;
64+ /// Maximum month value per ISO 8601
65+ pub ( crate ) const MAX_ISO_MONTH : u8 = 12 ;
66+ /// Minimum day value per ISO 8601
67+ pub ( crate ) const MIN_ISO_DAY : u8 = 1 ;
68+ /// Maximum hour value per ISO 8601 (24-hour format, 0-23)
69+ pub ( crate ) const MAX_ISO_HOUR : u8 = 23 ;
70+ /// Maximum minute value per ISO 8601
71+ pub ( crate ) const MAX_ISO_MINUTE : u8 = 59 ;
72+ /// Maximum second value per ISO 8601
73+ pub ( crate ) const MAX_ISO_SECOND : u8 = 59 ;
74+
4775/// `IsoDateTime` is the record of the `IsoDate` and `IsoTime` internal slots.
4876#[ non_exhaustive]
4977#[ derive( Debug , Default , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
0 commit comments