mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
23 lines
441 B
Swift
23 lines
441 B
Swift
import SwiftUI
|
|
//
|
|
// LastHeardText.swift
|
|
// Meshtastic Apple
|
|
//
|
|
// Created by Garth Vander Houwen on 5/25/22.
|
|
//
|
|
struct LastHeardText: View {
|
|
var lastHeard: Date?
|
|
|
|
let sixMonthsAgo = Calendar.current.date(byAdding: .month, value: -6, to: Date())
|
|
|
|
var body: some View {
|
|
if (lastHeard != nil && lastHeard! >= sixMonthsAgo!){
|
|
|
|
Text("Heard: \(lastHeard!, style: .relative) ago")
|
|
|
|
} else {
|
|
|
|
Text("Unknown Age")
|
|
}
|
|
}
|
|
}
|