Files
eqn.ios/Sources/Earthquake Network/Libs/Extensions/Foundation+Extensions.swift
T

29 lines
537 B
Swift

//
// Foundation+Extensions.swift
// Earthquake Network
//
// Created by Andrea Busi on 14/07/23.
// Copyright © 2023 Earthquake Network. All rights reserved.
//
import Foundation
extension Date {
func isBeforeInterval(
_ interval: TimeInterval
) -> Bool {
let now = Date()
return self.addingTimeInterval(interval) >= now
}
}
@objc
extension NSDate {
func isBeforeInterval(
_ interval: TimeInterval
) -> Bool {
return (self as Date).isBeforeInterval(interval)
}
}