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

18 lines 690 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { padLeftZeros } from '../strings'; /** * Transforms Date's object date part to a string. * * We cannot use Date.toISOString because it produces GMT time where the date can be different than local. */ export function formatDate(value, granularity = 'day') { const year = value.getFullYear(); const month = padLeftZeros(`${value.getMonth() + 1}`, 2); if (granularity === 'month') { return `${year}-${month}`; } const date = padLeftZeros(`${value.getDate()}`, 2); return `${year}-${month}-${date}`; } //# sourceMappingURL=format-date.js.map