@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
24 lines (23 loc) • 673 B
JavaScript
function setDayIndex(date, dayIndex) {
var diff = dayIndex - date.getDay();
date.setDate(date.getDate() + diff);
}
export function renderDayName(locale, dayIndex) {
var tempDate = new Date();
setDayIndex(tempDate, dayIndex);
return tempDate.toLocaleDateString(locale, { weekday: 'short' });
}
export function renderMonthAndYear(locale, baseDate) {
var result = baseDate.toLocaleDateString(locale, {
year: 'numeric',
month: 'long'
});
return result;
}
export function renderDayLabel(locale, date) {
return date.toLocaleDateString(locale, {
weekday: 'long',
month: 'short',
day: 'numeric'
});
}