New Plugin: Relative Time with Moment.js

This is correct. The plugin doesn’t do this. You can however do what you need without the plugin, using the same library used by the plugin, plus one other related library.

You will need to put the following in the page header of your page

<script src=""></script>
<script src=""></script>

You will also need the Toolbox plugin to run some javascript. Place the javascript to bubble element on your page and set things up similar to what I’ve done here.

By the way I did a search for countdown here on the forums and I saw that you got a couple of good answers to your post here. I’m curious as to why those don’t work for you.

Not easily I’m afraid. Not for me anyway, as my JS and plugin dev skills are very limited, unfortunately. Can you tell me a bit more about what it is you’re trying to achieve with this, though?

Hi @louisadekoya, I’m getting this error on my web browser:

Hi @JohnMark,

My attempts to prevent conflicts with other plugins seem to have introduced other errors. Please update to the latest version 2.1.0 and let me know if that has fixed the issue.


1 Like

Yes it fixed the problem. People have to CLOSE their browser to get it fixed. I will look later if it bring other issue. Thanks.

1 Like

I’m loving this plugin @louisadekoya, thank you for offering it for free.

This may be outside of the scope of this plugin, but I have another use case: the option to add a second date to use as relative time instead of current date time.

Let’s say you have a car. You have a PURCHASED date, and a SOLD date. By allowing a dynamic second date in the plugin, you could calculate something like " you owned this car for 2 years".

Is this a possibility?

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(c)},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: