On 2023-01-14 12:59, Dianne Skoll via Remind-fans wrote:
> >     OMIT Apr 16 MSG Emancipation Day
> >     # if it falls on a Sat, move it to Fri
> >     # if it falls on on a Sun, move it to Sun
> >     SET emancdayobs iif($Tw == 6, $T - 1, iif($Tw == 0, $T + 1, $T))
> >     IF $T != emancdayobs
> >       OMIT [emancdayobs] MSG Emancipation Day (observed)
> >     ENDIF
> 
> Doing this sort of date arithmetic subverts the Remind algorithm and
> might give incorrect results.  I would use:
> 
>       # Normal case: 16 April falls Mon-Fri
>       REM 16 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw >= 1 && $Tw <= 5] MSG 
> Emancipation Day

I wondered if I needed to add a SCANFROM in the solution.

>       # 16 April falls on Saturday: Observe on the 15th
>       REM 15 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Emancipation Day 
> (observed)
> 
>       # 16 April falls on Sunday: Observe on the 17th
>       REM 17 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Emancipation Day 
> (observed)
> 
> >     IF defined("LIVEINMA") || defined("LIVEINME")
> >       REM Mon Apr 14 SATISFY 1
> >       SET patriotsday $T
> >       OMIT [patriotsday] MSG Patriots Day
> >     ENDIF
> 
> The third Monday in a month is on or after the 15th, not the 14th.

Whoops!  That's what I get for shooting from the hip. :-)

> And Remind has syntactic sugar, so I would rewrite as:
> 
>       IF defined("LIVEINMA") || defined("LIVEINME")
>           REM Third Monday in April SCANFROM -7 ADDOMIT MSG Patriots Day

Whoa, I'd missed the arrival this bit of syntactic sugar!  <3

I knew theoretically about the ADDOMIT but it's not yet in my active
toolbelt.  Good to be refreshed.

-tim





_______________________________________________
Remind-fans mailing list
[email protected]
https://dianne.skoll.ca/mailman/listinfo/remind-fans
Remind is at https://dianne.skoll.ca/projects/remind/

Reply via email to