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

14 lines 754 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { getDateLabel, renderMonthAndYear, renderYear } from '../calendar/utils/intl'; export function isValidFullDate({ date, granularity }) { const regex = granularity === 'month' ? /^\d{4}-\d{2}(-\d{2})?$/ : /^\d{4}-\d{2}-\d{2}$/; return !!date.match(regex); } export function getSelectedDateLabel({ date, granularity, locale, }) { return granularity === 'month' ? renderMonthAndYear(locale, date) : getDateLabel(locale, date); } export function getBaseDateLabel({ date, granularity, locale, }) { return granularity === 'month' ? renderYear(locale, date) : renderMonthAndYear(locale, date); } //# sourceMappingURL=utils.js.map