Display all remaining days in the current month in react js

How can I display all the remaining days in the current month in react js / react-native ? Its needs to look like this, I don’t need CSS just javascript how to display it:

enter image description here

Answer

now = new Date();

// Tota number of days in current month
const totalDays = new Date(now.getFullYear(), now.getMonth()+1, 0).getDate();

// Today's day
const today = now.getDate();

// Remaining days of the month
const remainingDays = totalDays - today;

Leave a Reply

Your email address will not be published. Required fields are marked *