Skip to content

TimeZones is an enum that makes it easy to work with timezone names. Ex. Instead of writing "Europe/London" you can just write TimeZone.London or just .London.

Notifications You must be signed in to change notification settings

mortengustafsson/TimeZones-enums-for-swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

TimeZones-enums-for-swift

Swift: Enum for Time Zone names.

Add this file into you project when working with Time Zones. Instead of writing ex. "Europe/London" you can just write TimeZones.Europe.London.

Using TimeZones will help you prevent typos, and names are easily and quickly found with help from Xcode's Auto-completion.

Examples:

London:

let londonTimeZone = NSTimeZone(name: TimeZones.Europe.London.rawValue)

Sydney:

let sydneyTimeZone = NSTimeZone(name: TimeZones.Australia.Sydney.rawValue)

Copenhagen:

let copenhagenTimeZone = NSTimeZone(name: TimeZones.Europe.Copenhagen.rawValue)

Middelfart:

let middelfartTimeZone = NSTimeZone(name: TimeZones.Europe.Copenhagen.rawValue)
// Middelfart is a small town, with a funny name, in Denmark. 
// Middelfart is located in the same time zone as Copenhagen and therefore use .Copenhagen as time zone name. 

GMT:

let GMTTimeZone = NSTimeZone(name: TimeZones.GMT.rawValue)

TimeZones is based on names from the list on wikipedia: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

About

TimeZones is an enum that makes it easy to work with timezone names. Ex. Instead of writing "Europe/London" you can just write TimeZone.London or just .London.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages