@@ -160,7 +160,7 @@ func parseDate(dateStr string, now time.Time) (time.Time, int, error) {
160
160
var year int
161
161
162
162
if len (dateStr ) == 5 {
163
- // Parse date without year (DD/YY )
163
+ // Parse date without year (DD/MM )
164
164
date , err = time .Parse ("02/01" , dateStr )
165
165
if err == nil {
166
166
year = now .Year ()
@@ -186,6 +186,9 @@ func parseDate(dateStr string, now time.Time) (time.Time, int, error) {
186
186
}
187
187
188
188
func processReminders (reminders []Reminder , now time.Time , isBirthday bool , defaultRange int , templateCfg TemplateConfig ) {
189
+ // Truncate the current time to midnight (00:00:00)
190
+ now = time .Date (now .Year (), now .Month (), now .Day (), 0 , 0 , 0 , 0 , now .Location ())
191
+
189
192
for _ , reminder := range reminders {
190
193
date , year , err := parseDate (reminder .Date , now )
191
194
if err != nil {
@@ -224,8 +227,10 @@ func processReminders(reminders []Reminder, now time.Time, isBirthday bool, defa
224
227
}
225
228
226
229
for _ , yearsAhead := range []int {0 , 1 } {
230
+ // Truncate nextDate to midnight to avoid time component issues
227
231
nextDate := time .Date (now .Year ()+ yearsAhead , date .Month (), date .Day (), 0 , 0 , 0 , 0 , now .Location ())
228
232
233
+ // Calculate days between now and nextDate
229
234
daysUntilDate := int (nextDate .Sub (now ).Hours () / 24 )
230
235
if daysUntilDate <= rangeDays && daysUntilDate >= 0 {
231
236
printReminder (daysUntilDate , nextDate , year )
0 commit comments