Browse Source

Broaden timezones list.

pull/92/head
Abhishek 4 years ago
parent
commit
a048fd0296
  1. 13
      Clocker/Preferences/General/SearchDataSource.swift

13
Clocker/Preferences/General/SearchDataSource.swift

@ -58,8 +58,13 @@ class SearchDataSource: NSObject {
abbreviation: "AOE") abbreviation: "AOE")
timezoneArray.append(anywhereOnEarth) timezoneArray.append(anywhereOnEarth)
for (abbreviation, timezone) in TimeZone.abbreviationDictionary { for identifier in TimeZone.knownTimeZoneIdentifiers {
var tags: Set<String> = [abbreviation.lowercased(), timezone.lowercased()] guard let timezoneObject = TimeZone(identifier: identifier) else {
continue
}
let abbreviation = timezoneObject.abbreviation() ?? "Empty"
let identifier = timezoneObject.identifier
var tags: Set<String> = [abbreviation.lowercased(), identifier.lowercased()]
var extraTags: [String] = [] var extraTags: [String] = []
if let tagsPresent = timezoneMetadataDictionary[abbreviation] { if let tagsPresent = timezoneMetadataDictionary[abbreviation] {
extraTags = tagsPresent extraTags = tagsPresent
@ -69,10 +74,10 @@ class SearchDataSource: NSObject {
tags.insert(tag) tags.insert(tag)
} }
let timezoneIdentifier = NSTimeZone(name: timezone)! let timezoneIdentifier = NSTimeZone(name: identifier)!
let timezoneMetadata = TimezoneMetadata(timezone: timezoneIdentifier, let timezoneMetadata = TimezoneMetadata(timezone: timezoneIdentifier,
tags: tags, tags: tags,
formattedName: timezone, formattedName: identifier,
abbreviation: abbreviation) abbreviation: abbreviation)
timezoneArray.append(timezoneMetadata) timezoneArray.append(timezoneMetadata)
} }

Loading…
Cancel
Save