JSFiddle - React, Tailwind, and code Playground

by Michel Plungjan

JavaScript

var startDate = new Date(2012,6,1,8,0,0); 
var pics = ["b.gif","c.gif","a.gif"];
var aDay = 24*60*60*1000;
function getDateDiff(startDate,endDate) {
  var diff = endDate.getTime() - startDate.getTime();
  return Math.round(diff/aDay);
}
document.write('<br/>'+getDateDiff(startDate,new Date()));
document.write('<br/>' + pics[Math.floor(getDateDiff(startDate, new Date()) / 2) % 3])