[Remind-Fans] Better way to do "every other weekend"?

Tim Chase tim at thechases.com
Mon Jul 12 16:33:58 EDT 2021


On 2021-07-12 15:37, Dianne Skoll via Remind-fans wrote:
> REM Sat Sun FROM 2021-07-10 SATISFY [(($T - '2021-07-10') % 14) <
> 2] MSG Every other weekend

This looks like a nice  use-case for the recently added trigfrom()

REM Sat Sun FROM 2021-07-10 SATISFY [(($T - trigfrom()) % 14) < 2]
MSG Every other weekend

which just feels good.  (I might have been the instigating
troublemaker requesting trigfrom() and friends, so thanks! ;-)

> (My solution differs from yours in that we only
> start the reminders on 2021-07-10; we don't issue
> any before that start date.)

That's reasonable.  Neither with, nor without the abs() came up with
the right matches prior to the FROM start-date, and it would be
reasonable to assume that a newly-created event wouldn't have
stretched indefinitely back into history.

> In an expression, you can write a date constant
> as 'yyyy-mm-dd' rather than date(yyyy, mm, dd), which
> I find easier to read.

Hah, I find a lot of those little bits still hanging around, uses of
trigdate() instead of $T, monnum(trigdate()) instead of $Tm, or
"trigger(some_date)" (where newer code just properly creates a
trigger out of it in the date context), and the like.

Thanks for the suggestions!

-tim






More information about the Remind-fans mailing list