Tuesday, April 7, 2026

Challenges With Ancient Dates in Apple SDKs

Aaron Trickey:

Foundation’s date-handling code has an effective lower bound around January 1, 4713 BC on the Julian calendar. You can create a Date value representing an instant in time below that limit, but many Calendar methods will return unexpected values when you try to do anything with it.

[…]

And NSDatePicker does okay with BC dates. […] UIDatePicker, however, simply cuts off at AD 1.

[…]

When formatting or parsing dates, there is no way to override the built-in era symbols (like “BC” and “AD”) or, in locales where multiple conventions are in use, to choose among them.

[…]

(For going to and from strings, the older DateFormatter type does have such a property [for the Julian to Gregorian transition] defined, but it wasn’t carried forward into the newer Date.FormatStyle API, and it obviously doesn’t affect DateComponents conversions.)

Previously:

1 Comment RSS · Twitter · Mastodon


Graham Dawson

I have experienced similar issues, the worst being that I discovered changes in ancient date behaviour from macOS prior to 26.0 versus post, then further changes in 26.3, all of which resulted in bug reports from my app users depending on which macOS versions they were running. I had to implement some fundamental custom overrides to obtain consistent & correct behaviour of my app across all OS versions.

Leave a Comment