-
-
Notifications
You must be signed in to change notification settings - Fork 783
Closed
Description
i have a function
func handleDate(for label:UILabel, date: Date?) {
print("sam |\(date?.convertTo(region: .local).toFormat("HH:mm"))| = #\(date)# = \(Region.local.timeZone.secondsFromGMT() / (60 * 60)) GMT = \(TimeZone.current.secondsFromGMT() / (60 * 60)) GMT")
label.text = date?.in(region: .local).toFormat("HH:mm") ?? "00:00"
}from this i got
sam |Optional("09:10")| = #Optional(2001-01-01 08:10:00 +0000)# = 2 GMT = 2 GMT
as you can see i'm in 2 GMT (Copenhagen - Denmark)
so from 2001-01-01 08:10:00 +0000, i should get 10:10 and not 09:10. is there something wrong on my end or is it a bug?
also i have defaults set to
var calender = Calendar.autoupdatingCurrent
calender.firstWeekday = 2
SwiftDate.defaultRegion = Region(calendar: calender, zone: Zones.gmt.toTimezone(), locale: Locales.englishUnitedStatesComputer)Metadata
Metadata
Assignees
Labels
No labels