Add milestone creation and editing
This commit is contained in:
@@ -1,5 +1,22 @@
|
||||
import UIKit
|
||||
|
||||
func localDate(forUTCTimestamp timestamp: Int64) -> Date {
|
||||
var utc = Calendar(identifier: .gregorian)
|
||||
utc.timeZone = TimeZone(secondsFromGMT: 0)!
|
||||
let components = utc.dateComponents(
|
||||
[.year, .month, .day],
|
||||
from: Date(timeIntervalSince1970: TimeInterval(timestamp))
|
||||
)
|
||||
return Calendar.current.date(from: components) ?? Date()
|
||||
}
|
||||
|
||||
func utcTimestamp(forLocalDate date: Date) -> Int64 {
|
||||
let components = Calendar.current.dateComponents([.year, .month, .day], from: date)
|
||||
var utc = Calendar(identifier: .gregorian)
|
||||
utc.timeZone = TimeZone(secondsFromGMT: 0)!
|
||||
return Int64((utc.date(from: components) ?? date).timeIntervalSince1970)
|
||||
}
|
||||
|
||||
func errorAlert(_ message: String) -> UIAlertController {
|
||||
let alert = UIAlertController(title: "Something went wrong", message: message, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default))
|
||||
|
||||
Reference in New Issue
Block a user