Skip to content

Instantly share code, notes, and snippets.

View GeorgiyZhuravlev's full-sized avatar

Geogiy Zhuravlev GeorgiyZhuravlev

  • Mykolaiv Ukraine
View GitHub Profile
function getCountdown() {
// diff in seconds, comes through function's params
const diff = 60*60*24*4 + 60*60*22 + 60*35 + 5;
const MINUTE = 60;
const HOUR = MINUTE * 60;
const DAY = HOUR * 24;
const days = Math.floor(diff / DAY);
const hDiff = diff % DAY;
const hours = Math.floor(hDiff / HOUR);