JSFiddle - React, Tailwind, and code Playground
by jalbao
HTML
<button onclick=loopThroughAllLocaleCodes()>
Click
</button>
<div id='console'>
</div>
JavaScript
function getWeekdayAndMonthNamesByLocaleCode(localeCode, date) {
var Names = {
Weekday: "",
Month: ""
};
if (!(date instanceof Date && !isNaN(date.valueOf()))) {
date = new Date();
}
if (localeCode == null || localeCode.length < 2) {
localeCode = navigator.language;
}
Names.Month = date.toLocaleDateString(localeCode, {
month: 'long',
});
Names.Weekday = date.toLocaleDateString(localeCode, {
weekday: 'long'
});
return Names;
}
function loopThroughAllLocaleCodes() {
var lcs =...