[+] Create function to get alarms activating now

This commit is contained in:
Hykilpikonna
2021-01-17 14:31:29 -05:00
parent ba50233bd2
commit e0b6eb41fd
+7
View File
@@ -95,4 +95,11 @@ class Alarms: Codable
/// Get enabled alarms
var listEnabled: [Alarm] { return list.filter { $0.enabled } }
/// Get alarms that should be activating now
var listActivating: [Alarm]
{
let now = Date()
return listEnabled.filter { guard let n = $0.nextActivate else { return false }; return n < now }
}
}