Never return a year < 1990 from trigger()

This commit is contained in:
Dianne Skoll
2025-08-28 12:53:28 -04:00
parent 2f239f77a5
commit c5d661124c
4 changed files with 14 additions and 0 deletions

View File

@@ -4837,6 +4837,11 @@ Finally:
.PP
returns "30 November 1994 AT 22:00" for EST, which is 5 hours behind UTC.
The value for your time zone may differ.
.PP
\fBtrigger()\fR will \fInever\fR return a date earlier than "1 January 1990"
even if the UTC flag dictates that it should. So do not use it for reminders
before about 2 January 1990 in your local time zone. I do not anticipate this
restriction being a real problem.
.RE
.TP
.B trigtags()

View File

@@ -2179,6 +2179,9 @@ static int FTrigger(func_info *info)
tim = ARGV(1);
if (ARGV(2)) {
UTCToLocal(date, tim, &date, &tim);
if (date < 0) {
date = 0;
}
}
} else if (Nargs > 1) {
/* Date Time */
@@ -2193,6 +2196,9 @@ static int FTrigger(func_info *info)
ASSERT_TYPE(1, INT_TYPE);
if (ARGV(1)) {
UTCToLocal(date, tim, &date, &tim);
if (date < 0) {
date = 0;
}
}
}
}

View File

@@ -39472,6 +39472,7 @@ utctolocal(2051-01-01@04:44) => 2050-12-31@23:44
utctolocal(2050-03-13@05:00) => 2050-03-13@00:00
utctolocal(2050-11-06@04:00) => 2050-11-06@00:00
utctolocal(2050-11-06@07:00) => 2050-11-06@02:00
trigger(1990-01-01@01:22, 1) => "1 January 1990 AT 20:22"
No reminders.
-stdin-(9): `x' re-SET without being used (previous SET: -stdin-:8)
-stdin-(11): `y' UNSET without being used (previous SET: -stdin-:10)

View File

@@ -34,3 +34,5 @@ set a utctolocal('2051-01-01@04:44')
set a utctolocal('2050-03-13@05:00')
set a utctolocal('2050-11-06@04:00')
set a utctolocal('2050-11-06@07:00')
set a trigger('1990-01-01@1:22', 1)