31 lines
782 B
Swift
31 lines
782 B
Swift
//
|
|
// Random.swift
|
|
// Feels
|
|
//
|
|
// Created by Trey Tartt on 1/9/22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class Random {
|
|
static var tomorrowMidnightThirty: Date {
|
|
let components = DateComponents(hour: 0, minute: 30, second: 0)
|
|
var updateTime = Date()
|
|
if let tomorrow = Calendar.current.date(byAdding: .day, value: 1, to: Date()),
|
|
let tomorrowMorning = Calendar.current.date(byAdding: components, to: tomorrow) {
|
|
updateTime = tomorrowMorning
|
|
}
|
|
return updateTime
|
|
}
|
|
}
|
|
|
|
extension Date: RawRepresentable {
|
|
public var rawValue: String {
|
|
self.timeIntervalSinceReferenceDate.description
|
|
}
|
|
|
|
public init?(rawValue: String) {
|
|
self = Date(timeIntervalSinceReferenceDate: Double(rawValue) ?? 0.0)
|
|
}
|
|
}
|