|
|
|
@ -33,24 +33,41 @@ extension TimezoneDataOperations {
|
|
|
|
|
return dateFormatter.string(from: newDate) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func compactMenuHeader() -> String { |
|
|
|
|
func compactMenuTitle() -> String { |
|
|
|
|
var subtitle = CLEmptyString |
|
|
|
|
|
|
|
|
|
let shouldDayBeShown = DataStore.shared().shouldShowDayInMenubar() |
|
|
|
|
let shouldLabelBeShownAlongWithTime = !DataStore.shared().shouldDisplay(.placeInMenubar) |
|
|
|
|
|
|
|
|
|
if shouldDayBeShown { |
|
|
|
|
if shouldDayBeShown, shouldLabelBeShownAlongWithTime { |
|
|
|
|
let substring = date(with: 0, displayType: CLDateDisplayType.menuDisplay) |
|
|
|
|
subtitle.append(substring) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let shouldDateBeShown = DataStore.shared().shouldShowDateInMenubar() |
|
|
|
|
if shouldDateBeShown { |
|
|
|
|
if shouldDateBeShown, shouldLabelBeShownAlongWithTime { |
|
|
|
|
let date = Date().formatter(with: "MMM d", timeZone: dataObject.timezone()) |
|
|
|
|
if subtitle.isEmpty == false { |
|
|
|
|
subtitle.append(" \(date)") |
|
|
|
|
} else { |
|
|
|
|
subtitle.append("\(date)") |
|
|
|
|
} |
|
|
|
|
subtitle.isEmpty ? subtitle.append("\(date)") : subtitle.append(" \(date)") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return subtitle.isEmpty ? dataObject.formattedTimezoneLabel() : subtitle |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func compactMenuSubtitle() -> String { |
|
|
|
|
var subtitle = CLEmptyString |
|
|
|
|
|
|
|
|
|
let shouldDayBeShown = DataStore.shared().shouldShowDayInMenubar() |
|
|
|
|
let shouldLabelsNotBeShownAlongWithTime = DataStore.shared().shouldDisplay(.placeInMenubar) |
|
|
|
|
|
|
|
|
|
if shouldDayBeShown, shouldLabelsNotBeShownAlongWithTime { |
|
|
|
|
let substring = date(with: 0, displayType: CLDateDisplayType.menuDisplay) |
|
|
|
|
subtitle.append(substring) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let shouldDateBeShown = DataStore.shared().shouldShowDateInMenubar() |
|
|
|
|
if shouldDateBeShown, shouldLabelsNotBeShownAlongWithTime { |
|
|
|
|
let date = Date().formatter(with: "MMM d", timeZone: dataObject.timezone()) |
|
|
|
|
subtitle.isEmpty ? subtitle.append("\(date)") : subtitle.append(" \(date)") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
subtitle.isEmpty ? subtitle.append(time(with: 0)) : subtitle.append(" \(time(with: 0))") |
|
|
|
|