Moment js count down Javascript

Rojan Dhimal
Nov 2, 2022

In this story i will tell you how to get days hour minutes second countdown using moment .

const target_date = '';   
const now = moment();
const end = moment(target_date);
const duration = moment.duration(end.diff(now));
const days = duration.days();
const hours = duration.hours();
const minutes = duration.minutes();
const seconds = duration.seconds();

Thanks for reading.

--

--