Skip to content

Commit

Permalink
chore: rename the variable 'weekendDays' to 'weekDays'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehunn committed Jan 13, 2024
1 parent 87552e4 commit 406da04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/calendar/src/core/createCalendarInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function createCalendarInfo(cursorDate: Date, { weekStartsOn }: {
const { year, month, day } = parseDate(cursorDate);
const startWeekdayInMonth = getStartWeekdayInMonth(cursorDate, weekStartsOn);
const weeksInMonth = getWeeksInMonth(cursorDate, startWeekdayInMonth);
const weekendDays = arrayOf(7).map((index) => ({
const weekDays = arrayOf(7).map((index) => ({
value: setDay(cursorDate, index + weekStartsOn),
}));

Expand All @@ -25,7 +25,7 @@ export default function createCalendarInfo(cursorDate: Date, { weekStartsOn }: {
weekStartsOn,
startWeekdayInMonth,
weeksInMonth,
weekendDays,
weekDays,
today: {
weekIndex: getCurrentWeekIndex(day, startWeekdayInMonth),
dateIndex: getDay(cursorDate),
Expand Down
6 changes: 3 additions & 3 deletions packages/calendar/src/useCalendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ export function useCalendar({
const [viewType, setViewType] = useState(defaultViewType);

const calendar = createCalendarInfo(cursorDate, { weekStartsOn });
const { weekendDays, weeksInMonth, today, getDateCellByIndex } = calendar;
const { weekDays, weeksInMonth, today, getDateCellByIndex } = calendar;

const getHeaders = useCallback(
(viewType: CalendarViewType) => {
switch (viewType) {
case CalendarViewType.Month:
case CalendarViewType.Week:
return {
weekDays: withKey(weekendDays, "weekdays"),
weekDays: withKey(weekDays, "weekdays"),
};
default:
return {
weekDays: withKey([{ value: cursorDate }], "weekdays"),
};
}
},
[cursorDate, weekendDays],
[cursorDate, weekDays],
);

const createMatrix = useCallback(
Expand Down

0 comments on commit 406da04

Please sign in to comment.