UNPKG

@atlaskit/datetime-picker

Version:

A date time picker allows the user to select an associated date and time.

18 lines (16 loc) 569 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSafeCalendarValue = getSafeCalendarValue; var _getShortIsoString = require("./get-short-iso-string"); // oxlint-disable-next-line @atlassian/no-restricted-imports function getSafeCalendarValue(calendarValue) { // If `calendarValue` has a year that is greater than 9999, default to // today's date var yearIsOverLimit = calendarValue.match(/^\d{5,}/); if (yearIsOverLimit) { return (0, _getShortIsoString.getShortISOString)(new Date()); } return calendarValue; }