Function to get the first of the month by passing a random Date

 function getFirstDayOfMonth(startDate) {
            // Split the startDate in DD/MM/YYYY format
            const parts = startDate.split('/');
            // Extract the month and year
            const month = parts[0];
            const year = parts[2];
            // Create the first date of the month
            const firstDayOfMonth = `${month}/01/${year}`;
            return firstDayOfMonth;
        }

Leave a comment

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