Meshtastic-Apple/Meshtastic/Extensions/Date.swift

22 lines
410 B
Swift
Raw Normal View History

2023-04-25 17:56:57 -07:00
//
// Date.swift
// Meshtastic
//
// Copyright(c) Garth Vander Houwen 4/25/23.
//
import Foundation
extension Date {
func formattedDate(format: String) -> String {
let dateformat = DateFormatter()
dateformat.dateFormat = format
2023-09-04 20:17:09 -07:00
if self > Calendar.current.date(byAdding: .year, value: -5, to: Date())! {
return dateformat.string(from: self)
} else {
return "unknown.age".localized
}
2023-04-25 17:56:57 -07:00
}
}