On 2018-09-26 22:35, Dianne Skoll wrote:
> Tim Chase <[email protected]> wrote:
> 
> > I'm trying to figure out how to specify "the first weekend of each
> > month" (defined as the first Saturday of the month and the Sunday
> > that follows it).  
> 
> The trick is to realize the following equivalence:
> 
> "The Sunday after the first Saturday in a month"  is exactly the
> same as: "The Sunday on or after the 2nd of the month"

After sufficient banging my head against it, I came a similar
solution shortly before your reply arrived:

REM Sat Sun 2019 +1 UNTIL Jan 1 2020 SATISFY [ \
    ($Tw  == 6 && $Td < 8) \
    || ($Tw == 0 && $Td > 1 && $Td < 9) \
    ] MSG %"Weekend to work%" %b%

(the UNTIL is there since I only have the work schedule for 2019,
subject to change beyond that).

> Spend a bit of time to convince yourself of that equivalence...

It took a bunch of shell-scripting tests for various dates to make
sure I had all the weird edge cases, but this was just what I
needed.

(SATISFY is a great swiss-army-knife for whacking problems in a way
that fits my mind.)

Thanks!

-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