Time again for one of my holiday cop out posts :)

Here’s a couple of ways to calculate the number of days until Christmas:

Vanilla JavaScript

Math.floor((+new Date('2018-12-25') - +new Date()) / 86400000)

Using momentjs

moment('2018-12-25').diff(moment(), 'days')

Merry Christmas!





Did you enjoy this post?

Cool if I slip into your inbox with more?
Full posts, 1-2 times per week: