๐Ÿ†• 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