[Remind-Fans] Calculate difference between dates
Tim Chase
remind at tim.thechases.com
Thu Jul 20 06:47:17 EDT 2023
On 2023-07-19 12:00, B. William via Remind-fans wrote:
> Nice one Tim
> I ID birthdays with a B and anniversaries with an A so I trimmed it down to:
>
> FSET yr(y) "" + ord($Ty - y) + ""
>
> REM Jul 19 MSG B Steve's [yr(2023)]
> REM Jul 19 MSG A Jack & Dianne's [yr(2022)]
I don't know how many you have (I'm a bit of an event-fiend, so I
have 800+ birthdays and 100+ anniversaries, so rather than redundantly
adding B/A, I have each in their on context and use msgprefix() and
calprefix() to annotate the information in my agenda-view and
calendar-view. In my case, I have a birthdays.rem and anniversaries.rem
(and dozens of others) so I extract the file-name and use it as my
agenda prefix, so my agenda-view output comes out something like
BIRTHDAYS: Steve (42yo)
ANNIVERSARIES: Jack & Dianne (2nd)
thanks to the msgprefix(), and I put something like
# birthdays.rem
FSET icon "B"
# anniversaries.rem
FSET icon "A"
at the top of my files so that the calprefix() can pick up those
and display them when I'm using the -c variants
> Don't need year "0" (opinion)
Yeah, I don't really need this either (or the negative case where
you're pulling up a calendar for a year before someone was
born/married), but
1) most of the time, it's not an issue except for upcoming weddings
(where I put it on the calendar ahead of time) or birthdays on the
day-of where it shows up today as 0th which makes sense
2) if I am looking at historical/past calendar entries
But most of the time I'm entering birthdays/anniversaries/memorials,
they're after the fact, so the 0-year case doesn't show up.
I suppose it could be wrapped in
FSET yr(y) iif($Ty-y > 0, ord($Ty-y), "")
to silence those.
> but I'm curious about the double quotes.
> Any way to trim those?
Just omit them? :-)
I have my functions automatically wrap them in parens, so I have
the extra bit to do that. But if you just want the raw un-paren'ed
text, you can just
FSET yr(y) ord($Ty-y)
Just a few more tools from my remind toolkit :-)
-tim
More information about the Remind-fans
mailing list