I work with moment.js and I have 3 different dates, e.g.
I now try to get the difference in days from these dates until today (if it is less then 7 days ago) or the weeks until today (if it more than 7 days ago) and place it in several spans.
UPDATE thanks Thomas!
I got:
$(document).ready(function(){
$('.timestamp').html((index, html) => {
let date = moment(html, "DD.MM.YYYY HH:mm", true),
now = moment(),
days = Math.floor(Math.abs(date - now) / …Run Code Online (Sandbox Code Playgroud)