mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added named time zones (thx #2447)
This commit is contained in:
@@ -550,13 +550,18 @@ public extension Date {
|
||||
}
|
||||
|
||||
public extension TimeZone {
|
||||
init(fromUTC: String) {
|
||||
if fromUTC == "local" {
|
||||
init(from: String) {
|
||||
if let tz = TimeZone(identifier: from) {
|
||||
self = tz
|
||||
return
|
||||
}
|
||||
|
||||
if from == "local" {
|
||||
self = TimeZone.current
|
||||
return
|
||||
}
|
||||
|
||||
let arr = fromUTC.split(separator: ":")
|
||||
let arr = from.split(separator: ":")
|
||||
guard !arr.isEmpty else {
|
||||
self = TimeZone.current
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user