Updating Date.

Hi,

Is there any way to make a part of my repeater data show that something was posted “one day ago” or “One week ago” instead of the date showing the date with dd/mm/yyyy ?

Heres a link with the date posted showed as “one day ago” :
https://www.monster.ca/jobs/search/?q=vfx&where=vancover&client=classic&jobid=189284526

Cheers,
Noel

There is a function on this post at Stackoverflow which you can use.

Hey Andreas,
Thanks for your message, but those codes didn’t work well with wix?

This is my code so far that is set up for my wix page. I have for my date so far but, what would i need to add the function to make it output the words like : “one day ago” ?

$w.onReady( function () {
$w(“#dataset11”).onReady( () => {
$w(“#dataset1”).forEachItem( ($w) => {
const originalDate = $w(“#DATE”).text;
const newDate = originalDate.split(’ ‘).splice(0, 4).join(’ ‘);
$w(’#DATE’).text = newDate;
console.log('Time removed from Date/Time Stamp: New Date ’ + newDate);
});
});
});