[Remind-Fans] Reminder Popups with date and time
Mark Lawrence
nomad at null.net
Mon Jun 6 17:52:58 EDT 2011
On Mon Jun 06, 2011 at 09:23:50AM -0400, David F. Skoll wrote:
> On Mon, 6 Jun 2011 10:35:01 +1200
> Mark Lawrence <nomad at null.net> wrote:
>
> > I don't know if there is a way to generate that information from
> > remind itself,
>
> Here's my attempt at a pure Remind version. Very lightly tested; may not
> work!
>
> Regards,
>
> David.
>
> # Helper functions
> FSET _days(x) iif(x>1, x + " days", x==1, "1 day", "")
> FSET _hrs(x) iif(x>1, x + " hours", x==1, "1 hour", "")
> FSET _mins(x) iif(x>1, x + " minutes", x==1, "1 minute", "")
> FSET _smush(x, y) iif(x != "" && y != "", x + " and " + y, x + y)
>
> # Main function
> FSET _countdown(x) _smush(_smush(_days(x/1440), _hrs((x - 1440*(x/1440))/60)), _mins(x%60))
Neat. You continually amaze me David with the power of Remind. I
recommend built-in solutions over external ones provided the complexity
is about the same, so my Perl script is less than the ideal case, in
this case.
However, one remaining advantage of the Perl Time::Duration ago()
function is that it decreases the output precision of the further away
the point in time is. For example, something over 1 day away is printed
as "1 day 5 hours from now", ignoring the minutes which are somewhat
irrelevant. It also handles intervals further out such as weeks,
months, years which has some readability advantages. Finally it also
knows about events in the past ("3 hours 25 minutes ago") which could
be useful if you have missed appointments or are looking at history.
I'm sure those features can also be implemented/added to your Remind
_countdown() function. Would make a nice library extention. Sorry, no
I'm not volunteering :-)
Cheers,
Mark.
--
Mark Lawrence
More information about the Remind-fans
mailing list