Have relative_time support future time

Hi all,

I was looking at modifying relative_time to support future date/times.

My rationale was:

  1. use for timers. Lots of template code seems to be used to accomplish the same thing in automations, etc
  2. avoid confusion by end users. Quite honestly the function should have been called relative_age, and every so often a help thread comes up around this.

I’ve started to look at this, and the base code calls get_age() that appears to be taken from Django.

There’s an alternative in Django called timesince():

timesince() source

I was going to open a PR to put this in core.

Before I began I was wondering:

  1. will this PR be accepted?
  2. I was thinking of leaving the function/filter as being named relative_time and including the optional reversed and depth arguments for compatibility. Or should I just create a new function?
  3. the Django code uses internationalization. Do I need to worry about this?

Thanks,
Rob

Well, I submitted a PR anyway :slight_smile: