@atlaskit/datetime-picker
Version:
A date time picker allows the user to select an associated date and time.
11 lines • 418 B
JavaScript
// oxlint-disable-next-line @atlassian/no-restricted-imports
import { getShortISOString } from './get-short-iso-string';
export 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 getShortISOString(new Date());
}
return calendarValue;
}