New Feature with cron and job

Moment example:

const current_time = moment( new Date() ); // current time
const published_at = moment( article.published_at ); //get moment object of published_at
const differenceHours = moment.duration( current_time.diff( published_at ) ).asHours(); // difference in hours
if ( differenceHours < 24 ) {
    article.isNew = true;
}

That way there is no need to process all the articles daily with cron and etc.

1 Like