JSFiddle - React, Tailwind, and code Playground

by Ironim Morar

JavaScript

var objDate = new Date("01/12/2018"),
    locale = "en-us",
    month = objDate.toLocaleString(locale, { month: "long" });
    
    prevMonth = objDate.getMonth()-1;
    prevMonth = prevMonth.toLocaleString(locale, { month: "long" });
    
    console.log(objDate.getMonth()+1);

// console.log(month);


// or if you want the shorter date: (also possible to use "narrow" for "O"
// console.log(objDate.toLocaleString(locale, { month: "short" }));