I came across a problem when setting UIDatePicker preferredDatePickerStyle while in Beirut timezone:
This works fine almost all the time. However, when running while Beirut time zone is active, the app will crash:
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:
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?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.'