/* eslint-disable import/no-extraneous-dependencies */ import { useRef } from 'react'; import { getDate } from 'date-fns/getDate'; import { getMonth } from 'date-fns/getMonth'; import { date } from '@talend/utils'; import { WithCalendarGestureInjectedProps } from '../Gesture/propTypes'; const buildWeeks = date.buildWeeks; type DayCalendarProps = WithCalendarGestureInjectedProps & { month: number; year: number; }; function DayCalendar(props: DayCalendarProps) { const calendarRef = useRef(null); function isCurrentMonth(currentDate: Date) { return getMonth(currentDate) === props.month; } const { year, month, onKeyDown } = props; const weeks = buildWeeks(year, month); return ( {weeks.map((week, weekIndex) => ( {week.map((dateOfTheWeek, dayIndex) => { if (getMonth(dateOfTheWeek) !== props.month) { return ); })} ))}
; } const day = getDate(dateOfTheWeek); return (
); } DayCalendar.displayName = 'DayCalendar'; export default DayCalendar;