@@ -103,6 +103,25 @@ impl<C> Deref for Ref<'_, C> {
103103/// 3. From a RFC 9557 string via [`Self::try_from_str()`]
104104/// 4. From a [`RataDie`] via [`Self::from_rata_die()`]
105105///
106+ /// # Date ranges
107+ ///
108+ /// *Most* `Date` constructors will refuse to construct dates from `year` values outside of the range
109+ /// `-9999..=9999`, however since that is a per-calendar value, it is possible to escape that range
110+ /// by changing the era/calendar. Furthermore, this is not the case for [`Date::try_from_fields`] and
111+ /// date arithmetic APIs: these APIs let you construct dates outside of that range.
112+ ///
113+ /// `Date` types have a fundamental range invariant as well, and ICU4X will refuse to construct
114+ /// dates outside of that range, regardless of the calendar.
115+ /// ICU4X APIs will return an `Overflow` error (e.g. `DateAddError::Overflow`) in these cases, or clamp
116+ /// in the case of `Date::from_rata_die()`.
117+ ///
118+ /// This range is currently dates with an ISO year between `-999_999..=999_999`, but
119+ /// ICU4X reserves the right to change these bounds in the future.
120+ ///
121+ /// Since `icu_calendar` is intended to be usable by implementors of the ECMA Temporal specification,
122+ /// this range will never be smaller than Temporal's validity range, which roughly maps to ISO years
123+ /// -271,821 to 275,760 (precisely speaking, it is ± 100,000,000 days from January 1, 1970).
124+ ///
106125/// # Examples
107126///
108127/// ```rust
@@ -147,6 +166,9 @@ impl<A: AsCalendar> Date<A> {
147166 /// and the month as either ordinal or month code. It can constrain out-of-bounds values
148167 /// and fill in missing fields. See [`DateFromFieldsOptions`] for more information.
149168 ///
169+ /// This API will not construct dates outside of the fundamental range described on the [`Date`] type
170+ /// instead returning [`DateFromFieldsError::Overflow`].
171+ ///
150172 /// # Examples
151173 ///
152174 /// ```
@@ -189,8 +211,11 @@ impl<A: AsCalendar> Date<A> {
189211
190212 /// Construct a date from a [`RataDie`] and a calendar.
191213 ///
192- /// This method is guaranteed to round trip with [`Date::to_rata_die`]. Inputs
193- /// that were not produced by [`Date::to_rata_die`] might be clamped:
214+ /// This method is guaranteed to round trip with [`Date::to_rata_die`].
215+ ///
216+ /// For other values, This API will not construct dates outside of the fundamental range
217+ /// described on the [`Date`] type instead clamping the result:
218+ ///
194219 /// ```rust
195220 /// use icu::calendar::{Date, Gregorian, types::RataDie};
196221 ///
@@ -315,6 +340,9 @@ impl<A: AsCalendar> Date<A> {
315340
316341 /// Add a `duration` to this date, mutating it
317342 ///
343+ /// This API will not construct dates outside of the fundamental range described on the [`Date`] type,
344+ /// instead returning [`DateAddError::Overflow`].
345+ ///
318346 /// <div class="stab unstable">
319347 /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
320348 /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break.
@@ -338,7 +366,10 @@ impl<A: AsCalendar> Date<A> {
338366 Ok ( ( ) )
339367 }
340368
341- /// Add a `duration` to this date, returning the new one
369+ /// Add a `duration` to this date, returning the new one.
370+ ///
371+ /// This API will not construct dates outside of the fundamental range described on the [`Date`] type,
372+ /// instead returning [`DateAddError::Overflow`].
342373 ///
343374 /// <div class="stab unstable">
344375 /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
0 commit comments