UNPKG

@awsui/components-react

Version:

On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en

19 lines 931 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { useMemo } from 'react'; import { getCalendarMonthWithSixRows, getCalendarYear } from '../../internal/utils/date-time/calendar.js'; import { normalizeStartOfWeek } from '../../internal/utils/locale/index.js'; export default function useCalendarGridRows({ baseDate, granularity, locale, startOfWeek: rawStartOfWeek, }) { const isMonthPicker = granularity === 'month'; const rows = useMemo(() => { if (isMonthPicker) { return getCalendarYear(baseDate); } else { const startOfWeek = normalizeStartOfWeek(rawStartOfWeek, locale); return getCalendarMonthWithSixRows(baseDate, { startOfWeek, padDates: 'after' }); } }, [baseDate, isMonthPicker, rawStartOfWeek, locale]); return rows; } //# sourceMappingURL=use-calendar-grid-rows.js.map