Need a widget or method of formatting "time ago"...

jonlonon shared this question 4 years ago
Answered

For example, user completes an action, and when my event does it's thing, the date is saved in the data master. Later, when a page is refreshed, I want it to show x d y h z m, where x is number of days, h is number of hours, and z is number of minutes since the action was done.


Any ideas on how to format this in JustInMind? I know I could use On Change, or new screen, etc., to refresh it. But don't know how to find a widget for it.


I could write it in javascript, but would not know how to make it a widget that jives with your tool.


Thanks for any help available.

Comments (2)

photo
1

I can't think of a widget that does this, but I believe these two tutorials will help you with the time formating and current date.


Current Date and Time


Change the Format of a Date Input


Best,


Marc

photo
1

Marc, I truly appreciate the response. I pretty much already know how to work with the dates/times and format outputs using the text substring function.


I was hoping for an existing or suggested "method" or customizable widget that would allow me to maybe feed it the earlier saved start date and the current date, and it would spit out the difference between the two in months, days, and seconds up to some max number of months, etc. The easiest approach for now is to do only hours and days, then 1w, 2w, > 2 weeks, etc.


My concern was how to determine the differences when there are leap years and other changes every year on calendars. I am not sure how to calculate this accurately and even though I could learn how, exactly what are steps to create one that could connect to JIM as a calculation widget to appear in my available functions listing? That way, I could write it myself, hook it into JIM, then choose it as function, and feed it the start and end dates to get the output of the calculated values.


Hope that clarified my request. Again, response is fine, and I can work with that, but still wanted to calculate the accurate date difference values AND know how to prepare my own custom widget to actually use inside JIM.


Thanks,


Jon