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
The fundamental problem is that calendar.date(from: eraComponents) is using a formula based on Julian days for converting it to a timestamp. DateComponents(era: 1) becomes Julian Day 1721423, which is right on the BC/AD boundary, as expected. That Date has a timeIntervalSinceReferenceDate of -63114076800.0.
However, .dateInterval(of:for:) checks for dates that are close to the era boundary, and returns a hard-coded boundary:
...
case .era:
if time <-63113904000.0 {returnDateInterval(start:Date(timeIntervalSinceReferenceDate:-63113904000.0 - inf_ti), duration: inf_ti)}else{...
That time interval of -63113904000.0 pegs the start of the era on 0001-01-03, two days after the previously-returned Date.
The text was updated successfully, but these errors were encountered:
Below is a minimal reproduction case:
The fundamental problem is that
calendar.date(from: eraComponents)
is using a formula based on Julian days for converting it to a timestamp.DateComponents(era: 1)
becomes Julian Day1721423
, which is right on the BC/AD boundary, as expected. ThatDate
has atimeIntervalSinceReferenceDate
of-63114076800.0
.However,
.dateInterval(of:for:)
checks for dates that are close to the era boundary, and returns a hard-coded boundary:That time interval of
-63113904000.0
pegs the start of the era on0001-01-03
, two days after the previously-returnedDate
.The text was updated successfully, but these errors were encountered: