Browse Source

Take daylight savings into account while showing relative date string.

master
Abhishek Banthia 10 months ago
parent
commit
fa4887ec2e
  1. 3
      Clocker/Panel/UI/TimezoneDataSource.swift

3
Clocker/Panel/UI/TimezoneDataSource.swift

@ -216,7 +216,8 @@ extension TimezoneDataSource: PanelTableViewDelegate {
let currentModel = timezones[row] let currentModel = timezones[row]
if let timezone = TimeZone(identifier: currentModel.timezone()) { if let timezone = TimeZone(identifier: currentModel.timezone()) {
let offSet = Double(timezone.secondsFromGMT()) / 3600 let offSet = Double(timezone.secondsFromGMT()) / 3600
let localizedName = timezone.localizedName(for: .shortDaylightSaving, locale: Locale.autoupdatingCurrent) ?? "Error" let isDaylightSavings = timezone.isDaylightSavingTime()
let localizedName = timezone.localizedName(for: isDaylightSavings ? .shortDaylightSaving : .shortStandard, locale: Locale.autoupdatingCurrent) ?? "Error"
if offSet == 0.0 { if offSet == 0.0 {
return "\(localizedName)" return "\(localizedName)"
} else { } else {

Loading…
Cancel
Save