@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
28 lines (27 loc) • 751 B
JavaScript
function capFirstLetter(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
function getLocalMonthNames(locale) {
const d = new Date(2e3, 0);
const months = [];
for (let i = 0; i < 12; i++) {
const nameMonth = d.toLocaleString(locale, { month: "long" });
months.push(capFirstLetter(nameMonth));
d.setMonth(i + 1);
}
return months;
}
function generateYearRange(minYear, maxYear) {
if (minYear > maxYear) {
throw new Error(
"L'ann\xE9e minimale doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 l'ann\xE9e maximale."
);
}
return Array.from({ length: maxYear - minYear + 1 }, (_, i) => minYear + i);
}
export {
capFirstLetter,
generateYearRange,
getLocalMonthNames
};
//# sourceMappingURL=utils.js.map