I’m trying to create a simple(ish) plugin to dynamically display how long ago something (a post, a comment etc) was created. You can do current date/time minus the created date, I know, but I’m using momemnt.js which does a better job of displaying text like ‘just now’, ‘5 seconds ago’ etc. I have done most of the difficult bits - actually getting it to calculate and display the time difference from now, for a dynamic date that the user (bubble developer) sets as a property.
My issue however is that using the update function, I can display the current value of the plugin when something changes, e.g. a new comment is created, but I also want this to happen for existing comments when for example the comments page or list is displayed. It seems however that I can not refer to a property in the initialize function. Is there a way to do this?
I could create a dynamic date action field I suppose, and have the user set it in a workflow action on page load, but that would mean the user (bubble developer) setting the property twice, once in the workflow and once in the property window. I’m hoping to avoid this.
I’m new to JS so probably just down to my lack of knowledge. I’m sure I’m missing something obvious. Any guidance would be much appreciated.