I am using very simple date format but some devices returning a wrong year. This only happened on 1 device in Japan so I could not reproduce it.
let timeStamp = Date().timeIntervalSince1970
let date = Date(timeIntervalSince1970: timeStamp)
let dateFormatter = DateFormatter()
dateFormatter.locale = NSLocale.current
dateFormatter.dateFormat = format
let result = dateFormatter.string(from: date)
print(result)
The result is 0005-10-13
Anh help!
Ok, I found the issue. If device set calendar to Japan this issue will happen. To fix it just add like below.
Thank to @Martheen