App crash when setting UIDatePicker.preferredDatePickerStyle in Beirut timezone

I came across a problem when setting UIDatePicker preferredDatePickerStyle while in Beirut timezone:

  • Create a new, empty iOS 14 Swift project

  • create a new UIDatePicker variable in viewDidLoad of the ViewController at set its preferredDatePicker Style

  • run the app

Code Block language
class ViewController: UIViewController {
  override func viewDidLoad() {
    super.viewDidLoad()
    let datePicker = UIDatePicker()
    datePicker.preferredDatePickerStyle = .inline // << CRASH
  }
}


This works fine almost all the time. However, when running while Beirut time zone is active, the app will crash:

libc++abi.dylib: terminating with uncaught exception of type NSException
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid calculation: number of calculated days is not dividable by the number of days in a week.'

Is this a know problem? Is there any workaround to avoid this number of calculated days is not dividable by the number of days in a week error?



Well, that sucks )-:

FYI, you can reproduce this without reconfiguring your device by setting the time zone on the picker:

Code Block
let datePicker = UIDatePicker()
let tz = TimeZone(identifier: "Asia/Beirut")!
datePicker.timeZone = tz
datePicker.preferredDatePickerStyle = .inline


You should definitely file a bug about this. Please post your bug number, just for the record.

As to a workaround, nothing obviously springs to mind. If no one else chimes in I recommend that you open a DTS tech support incident so that I, or one of my colleagues, can take a more in-depth look.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks @eskimo. I have filed a bug report (FB9012689) and opend a TSI as recommended.
Hello guys any updates on this issue ?
I am facing the same error.

any updates on this issue?

Is this on iOS? If so, can you try this on the current iOS 14.5b5 seed (18E5186a)? Looking at Agenor’s bug there’s some indicating that it’s fixed there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
App crash when setting UIDatePicker.preferredDatePickerStyle in Beirut timezone
 
 
Q