I have weird behavior regarding dates and I cannot figure out if it is due to iOS 16 beta running on a device or due to the different timezone/region.
A user of my app based in London has reported an issue caused by dates showing as such, whether they are am or pm dates which is not the usual case:
2022-08-20T7:01:07+0100
I format my dates the following way because the backend requires it:
let format = DateFormatter()
format.timeZone = .current
format.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let dateString = format.string(from: self)
Therefore, I do not see why the 7 is showing without a 0 before, I should be getting 2022-08-20T07:01:07+0100
instead.
Another case is the following format used for logs:
return "\(Date().to(format: "dd/MM/yyyy HH:mm:ss")) (\((TimeZone.current.identifier)))"
This usually prints 20/04/2022 07:57:15 (Asia/Beirut)
but for that specific user, it prints 20/08/2022 7:02:31 pm (Europe/London)
.
So the problem is that for that user, the dates are not being formatted using a 24 hour rule.
I tried reproducing the user's case by changing my timezone as well as the region of my phone and also playing with the 24-hour Time setting but I cannot reproduce the user's case, neither on iOS 15 or iOS 16.
Does anybody have a clue what could be going wrong or have I missed an important point?