🆕 Relative Time ("1 hour ago") Plugin

The Relative Time plugin transforms a date time value into a relative description like “2 hours ago.”

Please play with it and check out the documentation for the underlying library and give your feedback. There are some configuration options, and it seems to round pretty heavily, so we may need to tune it a bit.

23 Likes

Bravo :clap::clap::clap:

1 Like

This works for me in the Editor but does not display anything on my device. I have a feeling it’s a language issue, as my PC uses US English by default, but my Android phone uses Canada English.

Is there any way to make this work regardless of locale? I assume there would be issues with translating the text it generates, which could be why it only seems to work for US-language settings.

Edit: confirmed — I changed my device’s language to US English and it magically showed up in the app. If this can’t be forced to work with multiple locale’s, I recommend adding some hint text to the Plugin so users are aware of this limitation.

Edit2: just checked the gitlab details and there seems to be multiple languages set up already. From what I can tell, Canada English should still use the “en” abbreviation, but it’s not working. Is anyone aware of another English locale/abbreviation that needs to be added? Sorry, I’m not an experienced programmer, so I’ve likely butchered the description of this issue.

If there is, I’d love to know what it is!

I’ve basically given up on most of the Date Plugins, and especially the Format Date one. Sometimes it works, and sometimes it doesn’t. And whilst I’m fairly convinced it’s a regional problem, I’ve struggled to find any consistent and repeatable behaviour.

Most of the functionality they provide can already be achieved with a bit of date math, anyway.

1 Like

Shoots… the plugins are so awesome and simple though!

It looks as though other locales can be loaded into the script, but I guess I’d have to fork it and build out my own version to use in the Experimental Code column. Not my strength but I might give it a shot later.

If you’re going to go to that trouble (and you can make it work), then don’t forget to make locale a configuration option, and then send @david a Pull Request :stuck_out_tongue:

1 Like