Skip to content
Snippets Groups Projects
Commit f78a20a5 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Use current timezone for date formatting

parent 7054b3d1
Branches
No related tags found
No related merge requests found
......@@ -9,11 +9,11 @@ import Foundation
public extension DateFormatter
{
static func pattern(_ pattern: String) -> DateFormatter {
static func pattern(_ pattern: String, timeZone: TimeZone = TimeZone.current) -> DateFormatter {
let formatter = DateFormatter()
formatter.dateFormat = pattern
formatter.calendar = Calendar(identifier: .iso8601)
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.timeZone = timeZone
return formatter
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment