Forum Documentation Showcase Pricing Learn more

New Plugin: Relative Time with Moment.js

Hi @petter, thanks. The plugin doesn’t currently support this feature. It was my original intention to include it right from the start but I couldn’t quite make it work. I’ll take another look during the week and let you know.

1 Like

Awesome @louisadekoya, thanks!

Just started getting a error for every instance of Relativetime in my app. Just checked the demo site and the same error is occurring.

WARNING: Error parsing plugin code for update (Relative Time). Please check
function(a,b,e){var c=b.date_from;b=b.interval;var;©;null!==b&&(null!,,{d©},b))};

This seems to be happening everywhere. I’m currently getting “Error parsing plugin code” errors thrown with Expressions plug-in. There seems to be an overall Bubble bug with plugins at the moment… It’s pretty nasty. I assume the issue is being worked on (another user submitted bug report based on observations over in the Air Date/Time Picker thread…

Thanks for pointing out the error. Looks to have been resolved now (by the Bubble team).

Just confirming that I ran into this bug as well but it seems to be resolved.

It first manifested while I was using version 2.0.0 of this plugin. Upgraded to the new version, 2.1.0 and the issue persisted. But now things are working properly, so also of the belief it’s a Bubble bug. :slight_smile:

1 Like

Hi All,

I have updated the plugin to add:

  1. The ability to hide the suffix. So you can have the current value as “2 days” instead of “2 days ago”. Also works for the prefix, so “2 days” instead of “in 2 days”.

  2. The ability to express your date relative to a defined baseline date instead of current date/time. See @petter’s post above for an example use case. Thanks for the suggestion, Petter.

I have updated the instructions and demo page. I hope you find the update useful.



Making a great plugin even better. Really appreciate those changes! :smiley:

1 Like

Thanks a lot, really great plugin!

I’m using the Language feature in Bubble, so I’m using Find and Replace to change the words in the plugin into the local language. For those who want the same, here are the strings used:

Range Key Sample Output
0 to 44 seconds s a few seconds ago
44 to 44 seconds ss 44 seconds ago
45 to 89 seconds m a minute ago
90 seconds to 44 minutes mm 2 minutes ago … 44 minutes ago
45 to 89 minutes h an hour ago
90 minutes to 21 hours hh 2 hours ago … 21 hours ago
22 to 35 hours d a day ago
36 hours to 25 days dd 2 days ago … 25 days ago
26 to 45 days M a month ago
45 to 319 days MM 2 months ago … 10 months ago
320 to 547 days (1.5 years) y a year ago
548 days+ yy 2 years ago … 20 years ago

Hi @louisadekoya,

We would like have a relative time solution for a return data from API workflow. Do you know how we can hack this maybe using your plugin or something else?

Hi @timothymugendi,

What exactly would you like to do? Please expand on “solution for a return data from API workflow”

I haven’t tried it but if your API is returning a valid date, you should be able to use it as the source date for the plugin.

I actually want to send data to an external android app from Bubble db via API workflow. The way we send this data is to include a Return data from API action at the end of an API workflow as below:


What I wish to be able to do using your plugin is to convert this date to relative time text via such a workflow before returning it to my app. The means I will return a text instead of a date value.

So in this case, I would replace below workflow with results of Moment.js plugin


Let me know if you need more information.

Have you tried it yet? I think you should and let me know how you get on. The plugin element takes a date as input and spits out some text, so in theory, if you pass it your result of step 1’s modified date you can set your return text to the plugin element’s value.


Hi, thank you so much for this plugin. It seems incredibly useful, but for some reason, I cannot get anything to show. Using the debugger, it seems like all the data is passed correctly, but nothing appears :frowning:

You’re part way there. In this case, you placed the relative time element in the repeating group. So, each individual cell would have its own relative value.

However, to expose the generated value (ex. an hour ago), you need to pull it into a text element that references RelativeTime B’s value.


Ahhh how did I not realize that. Thank you :slight_smile:


Hey! Thanks for the awesome plugin. Is there a way to use Moments.js with different languages?

Thanks - I’m pleased that you find the plugin useful. The moment.js library does support ‘locales’, but this is not included in the plugin. I gather it significantly increases the size of the library that is loaded. If this is very important to your app, I can create a private ‘with-locales’ version of the plugin, which I could grant your app access to, but I can’t guarantee that I will maintain it going forward as I don’t want to commit to maintaining two versions - unless lots of people want the locales feature.

You can see it working here - note that the locale dropdown does not take a dynamic value. I’m afraid it would take more time than I have right now to make it so.

Hello @louisadekoya

Where can I found the plugin Relative Time with Locales?


Hi @JohnMark, I never published it publicly. I don’t intend to either, but as I said above I can add your app to it if you want but with no commitment to maintain it going forward. I find that it does make the page slower but if you are interested in a specific locale, one idea might be to fork the plugin and keep just that locale. That should eliminate any performance concerns.

1 Like