Skip to content

Commit

Permalink
refactor(EuiDatePicker): use moment weekdays API to retrieve long-tex…
Browse files Browse the repository at this point in the history
…t weekday names
  • Loading branch information
mgadewoll committed May 15, 2024
1 parent 1098b86 commit 52fdd83
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,8 @@ export default class Calendar extends React.Component {
[0, 1, 2, 3, 4, 5, 6].map(offset => {
const day = addDays(cloneDate(startOfWeek), offset);
const localeData = getLocaleData(day);
const localeStartDayOfWeek = localeData._week.dow;

const weekStartDayIndex = localeStartDayOfWeek + offset;
// determine the current day index based on the week starting day (Sunday vs Monday)
const currentDayIndex =
weekStartDayIndex < 7 ? weekStartDayIndex : 7 - weekStartDayIndex;

const weekDayName = this.formatWeekday(localeData, day);
const weekDayNameLong = localeData._weekdays[currentDayIndex]
const weekDayNameLong = localeData.weekdays(day);

return (
<div key={offset} className="react-datepicker__day-name">
Expand Down

0 comments on commit 52fdd83

Please sign in to comment.