<script src="https://unpkg.com/dayjs@1.8.21/dayjs.min.js"></script>

const date1 = dayjs('2021-03-13');
const date2 = dayjs();

let hours = date2.diff(date1, 'hours');
const days = Math.floor(hours / 24);
hours = hours - (days * 24);

console.log('Days: ', days);
console.log('Hours: ', hours);
Last Updated:
Contributors: pengrengui