We are experiencing a new issue with the inline DateInlineRow and DateTimeInlineRow specifically inconsistency on the timezone used for row value vs. picker input.
Environment
Eureka 5.3.1 (Latest)
Xcode 12.1
iOS 14.1
Simulator iPhone 8 Plus
Issue
Our users can set a user profile timezone on their profile, allowing their timezone to be set to something other than their current locale/timezone from the iOS device.
The Device timezone is on America/Denver (GMT-7)
The User Profile timezone is set to "Pacific/Auckland" (GMT+13)
We previously were using DateRow and DateTimeRow and correctly set the timezone using:
Now, we removed the above code and have tried to hardcode the timezone directly using defaultCellSetup for the inline row experience (we exhausted all other options of configuring datePicker, but below is the simplest example):
CORRECT: The display value and changing selected calendar date results in the correct value as seen in Date and Time 1 field below...
INCORRECT: Calendar picker shows incorrect month when expanded - "October 2020" is displayed, but when expanded, it is showing "September 2020".
Has anyone else experienced this or know how to resolve this?
UPDATE
Tried this in a Playground decoupled from Eureka completely... did I stumble upon a new date picker bug?
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
let picker = UIDatePicker()
override func loadView() {
let view = UIView()
view.backgroundColor = .white
picker.preferredDatePickerStyle = .inline
picker.frame = CGRect(x: 0, y: 0, width: 320, height: 480)
picker.timeZone = TimeZone(identifier: "Pacific/Auckland")
picker.calendar = Calendar(identifier: .gregorian)
picker.date = Date()
picker.addTarget(self,
action:#selector(MyViewController.datePickerValueChanged(_:)), for: .valueChanged)
view.addSubview(picker)
self.view = view
}
@objc func datePickerValueChanged(_ sender: UIDatePicker) {
print("value: \(picker.date)")
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
If you don’t set the TZ, it works as expected, shows the correct month selected on expand, changes month as you scroll wheel.
If you set the TZ to "America/Denver" — it works. Heck, if you set it to "BOO" — it works (defaulting back to current, I believe).
However, if you set the TZ to "Pacific/Auckland" (your test case with NZ timezone) it borks — expanding months show September, and doesn’t change the month when you switch from October to September (stays October).
We are experiencing a new issue with the inline
DateInlineRow
andDateTimeInlineRow
specifically inconsistency on the timezone used for row value vs. picker input.Environment
5.3.1
(Latest)12.1
14.1
iPhone 8 Plus
Issue
Our users can set a user profile timezone on their profile, allowing their timezone to be set to something other than their current locale/timezone from the iOS device.
We previously were using
DateRow
andDateTimeRow
and correctly set the timezone using:Now, we removed the above code and have tried to hardcode the timezone directly using
defaultCellSetup
for the inline row experience (we exhausted all other options of configuring datePicker, but below is the simplest example):CORRECT: The display value and changing selected calendar date results in the correct value as seen in Date and Time 1 field below...
INCORRECT: Calendar picker shows incorrect month when expanded - "October 2020" is displayed, but when expanded, it is showing "September 2020".
Has anyone else experienced this or know how to resolve this?
UPDATE
Tried this in a Playground decoupled from Eureka completely... did I stumble upon a new date picker bug?
If you don’t set the TZ, it works as expected, shows the correct month selected on expand, changes month as you scroll wheel.
If you set the TZ to "America/Denver" — it works. Heck, if you set it to "BOO" — it works (defaulting back to current, I believe).
However, if you set the TZ to "Pacific/Auckland" (your test case with NZ timezone) it borks — expanding months show September, and doesn’t change the month when you switch from October to September (stays October).