From d80aa583d0fcf42b9934a28202406a6baf023abe Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 14 Sep 2019 16:17:29 -0700 Subject: [PATCH] Fix for timezone clash. --- .../General/PreferencesViewController.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Clocker/Preferences/General/PreferencesViewController.swift b/Clocker/Preferences/General/PreferencesViewController.swift index 6116636..1dcc4ef 100644 --- a/Clocker/Preferences/General/PreferencesViewController.swift +++ b/Clocker/Preferences/General/PreferencesViewController.swift @@ -807,14 +807,14 @@ extension PreferencesViewController { let currentSelection = searchResultsDataSource.timezoneFilteredArray[availableTimezoneTableView.selectedRow % searchResultsDataSource.timezoneFilteredArray.count] let metaInfo = metadata(for: currentSelection) - data.timezoneID = metaInfo.0 + data.timezoneID = metaInfo.0.name data.formattedAddress = metaInfo.1.formattedName } else { let currentSelection = searchResultsDataSource.timezoneArray[availableTimezoneTableView.selectedRow - 1] let metaInfo = metadata(for: currentSelection) - data.timezoneID = metaInfo.0 + data.timezoneID = metaInfo.0.name data.formattedAddress = metaInfo.1.formattedName } @@ -838,13 +838,13 @@ extension PreferencesViewController { isActivityInProgress = false } - private func metadata(for selection: TimezoneMetadata) -> (String, TimezoneMetadata) { + private func metadata(for selection: TimezoneMetadata) -> (NSTimeZone, TimezoneMetadata) { if selection.formattedName == "Anywhere on Earth" { - return ("GMT-1200", selection) + return (NSTimeZone(name: "GMT-1200")!, selection) } else if selection.formattedName == "UTC" { - return ("GMT", selection) + return (NSTimeZone(name: "GMT")!, selection) } else { - return (selection.formattedName, selection) + return (selection.timezone, selection) } }