Browse Source

Fix for timezone clash.

pull/92/head
Abhishek 5 years ago
parent
commit
d80aa583d0
  1. 12
      Clocker/Preferences/General/PreferencesViewController.swift

12
Clocker/Preferences/General/PreferencesViewController.swift

@ -807,14 +807,14 @@ extension PreferencesViewController {
let currentSelection = searchResultsDataSource.timezoneFilteredArray[availableTimezoneTableView.selectedRow % searchResultsDataSource.timezoneFilteredArray.count] let currentSelection = searchResultsDataSource.timezoneFilteredArray[availableTimezoneTableView.selectedRow % searchResultsDataSource.timezoneFilteredArray.count]
let metaInfo = metadata(for: currentSelection) let metaInfo = metadata(for: currentSelection)
data.timezoneID = metaInfo.0 data.timezoneID = metaInfo.0.name
data.formattedAddress = metaInfo.1.formattedName data.formattedAddress = metaInfo.1.formattedName
} else { } else {
let currentSelection = searchResultsDataSource.timezoneArray[availableTimezoneTableView.selectedRow - 1] let currentSelection = searchResultsDataSource.timezoneArray[availableTimezoneTableView.selectedRow - 1]
let metaInfo = metadata(for: currentSelection) let metaInfo = metadata(for: currentSelection)
data.timezoneID = metaInfo.0 data.timezoneID = metaInfo.0.name
data.formattedAddress = metaInfo.1.formattedName data.formattedAddress = metaInfo.1.formattedName
} }
@ -838,13 +838,13 @@ extension PreferencesViewController {
isActivityInProgress = false isActivityInProgress = false
} }
private func metadata(for selection: TimezoneMetadata) -> (String, TimezoneMetadata) { private func metadata(for selection: TimezoneMetadata) -> (NSTimeZone, TimezoneMetadata) {
if selection.formattedName == "Anywhere on Earth" { if selection.formattedName == "Anywhere on Earth" {
return ("GMT-1200", selection) return (NSTimeZone(name: "GMT-1200")!, selection)
} else if selection.formattedName == "UTC" { } else if selection.formattedName == "UTC" {
return ("GMT", selection) return (NSTimeZone(name: "GMT")!, selection)
} else { } else {
return (selection.formattedName, selection) return (selection.timezone, selection)
} }
} }

Loading…
Cancel
Save