JSFiddle - React, Tailwind, and code Playground

JavaScript

function date_locale( thisDate, locale )
    {
        if( locale==undefined )
            locale = 'fr-FR'; 
// set your default country above (yes, I'm french !)
// then the default format is "dd/mm/YYY"

        if( thisDate == undefined ){
            var d = new Date();
        }else{
          var d = new Date(thisDate);
        }
        return d.toLocaleDateString(locale);
    }
    
    var thisDate = date_locale();
    var dayN = thisDate.slice(0,2);
    var monthN = thisDate.slice(3,5);
    console.log(dayN);
    console.log(monthN);