diff --git a/ical/parse.go b/ical/parse.go
index a308c56..3a5f32a 100644
--- a/ical/parse.go
+++ b/ical/parse.go
@@ -16,9 +16,11 @@ import (
"time"
)
-// LooseCategory is the category used to indicate that the event is without a fixed date or deadline
+// LooseCategory is the category used to indicate that the event is without a
+// fixed date or deadline
const LooseCategory = "loose"
-// ShowAlarmCategory is the category used to indicate that the alarm details should be displayed in the notification
+// ShowAlarmCategory is the category used to indicate that the alarm details
+// should be displayed in the notification
const ShowAlarmCategory = "show-alarm"
type Parser struct {
diff --git a/notify/notify.go b/notify/notify.go
index d0226c8..89ba89b 100644
--- a/notify/notify.go
+++ b/notify/notify.go
@@ -5,6 +5,9 @@ import (
)
const Tpl = `
+{{- if and (not .Loose) .IsImminent}}
+📢🔥🚨 IN {{.TimeDifference}} 🚨🔥📢
+{{- end}}
{{- if .Summary}}
{{.Summary}}
@@ -45,16 +48,10 @@ Attendees:
{{- end}}
{{- if .ShowAlarm}}
{{.Source}} 🔔 {{.DurIso8601}}
-{{- end}}
-
-{{- if and (not .Loose) .IsImminent}}
-
-📢🔥🚨 IN {{.TimeDifference}} 🚨🔥📢
-
{{- end}}
`
-const ImminenceThreshold = 1 * time.Hour
+const ImminenceThreshold = 2 * time.Hour
type Notifier interface {
Notify(n Notification) error
@@ -122,9 +119,9 @@ func (n Notification) EventTimeTz() string {
return n.EventTime.Location().String()
}
-// IsUrgent checks if the notification is urgent based on the difference between EventTime and Time
+// IsImminent checks if the notification is urgent based on the difference between EventTime and Time
func (n Notification) IsImminent() bool {
- return n.EventTime.Sub(n.Time) > ImminenceThreshold
+ return n.EventTime.Sub(n.Time) < ImminenceThreshold
}
// TimeDifference returns the difference between EventTime and Time