To get the month name starting from a capital letter, you can simply use a combination of string manipulation functions like substr()
and toUpperCase()
in JavaScript. Here's an example:
index.tsx578 chars15 lines
In the above example, we first get the full month name using toLocaleDateString()
method with locale 'fr-fr'. Then we get the first letter of month and convert it to uppercase using substr()
and toUpperCase()
methods. We also get the rest of the month name and convert it to lowercase using substr()
method. Finally, we combine both parts of month name together to get formatted month and use it in toLocaleDateString()
.
gistlibby LogSnag