From fa4887ec2e357535dd5d11677a5f77da96e81be6 Mon Sep 17 00:00:00 2001 From: Abhishek Banthia <8280282+n0shake@users.noreply.github.com> Date: Sat, 2 Mar 2024 12:46:04 -0500 Subject: [PATCH] Take daylight savings into account while showing relative date string. --- Clocker/Panel/UI/TimezoneDataSource.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Clocker/Panel/UI/TimezoneDataSource.swift b/Clocker/Panel/UI/TimezoneDataSource.swift index 602ae9e..38444f1 100644 --- a/Clocker/Panel/UI/TimezoneDataSource.swift +++ b/Clocker/Panel/UI/TimezoneDataSource.swift @@ -216,7 +216,8 @@ extension TimezoneDataSource: PanelTableViewDelegate { let currentModel = timezones[row] if let timezone = TimeZone(identifier: currentModel.timezone()) { 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 { return "\(localizedName)" } else {