Fri Aug 09 2024
How to Create Countdown Timer in React Component
Next.JS230 views
If you want to launch a new site or add new pages, a countdown timer is a great way to inform your users that your site is under construction and will be live soon. It creates anticipation and keeps visitors engaged, especially when paired with a visually appealing under-construction page. Here, we'll walk through a simple countdown timer component of a Next.js and TailwindCSS project.
Time left calculation from millisecond
const dys = Math.floor(difference / (1000 * 60 * 60 * 24));
const hrs = Math.floor((difference / (1000 * 60 * 60)) % 24);
const mnt = Math.floor((difference / (1000 * 60)) % 60);
const snd = Math.floor((difference / 1000) % 60);

Reference:
Download the full project from WebGraphiz.com
Author:Geekboots