{"record":{"id":"0a4f8f5c8cc113b1","repo":"vuetifyjs/vuetify","slug":"input-is-not-a-valid-timestamp-it-must-be-a-da","errorCode":null,"errorMessage":"${input} is not a valid timestamp. It must be a Date, number of milliseconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.","messagePattern":"(.+?) is not a valid timestamp\\. It must be a Date, number of milliseconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm\\. Zero-padding is optional and seconds are ignored\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vuetify/src/components/VCalendar/util/timestamp.ts","lineNumber":137,"sourceCode":"export function parseTimestamp (input: VTimestampInput, required: true, now?: CalendarTimestamp): CalendarTimestamp\nexport function parseTimestamp (input: VTimestampInput | null, required = false, now?: CalendarTimestamp | null): CalendarTimestamp | null {\n  if (typeof input === 'number' && isFinite(input)) {\n    input = new Date(input)\n  }\n\n  if (input instanceof Date) {\n    const date: CalendarTimestamp = parseDate(input)\n\n    if (now) {\n      updateRelative(date, now, date.hasTime)\n    }\n\n    return date\n  }\n\n  if (typeof input !== 'string') {\n    if (required) {\n      throw new Error(`${input} is not a valid timestamp. It must be a Date, number of milliseconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.`)\n    }\n    return null\n  }\n\n  // YYYY-MM-DD hh:mm:ss\n  const parts = PARSE_REGEX.exec(input)\n\n  if (!parts) {\n    if (required) {\n      throw new Error(`${input} is not a valid timestamp. It must be a Date, number of milliseconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.`)\n    }\n\n    return null\n  }\n\n  const timestamp: CalendarTimestamp = {\n    date: input,\n    time: '',","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/vuetifyjs/vuetify/blob/8d153908dffb7592eb389ddbfbab955a0ccc977f/packages/vuetify/src/components/VCalendar/util/timestamp.ts#L119-L155","documentation":"Thrown by parseTimestamp() in VCalendar when `required: true` and the input is neither a Date, a finite number (ms-since-epoch), nor a string. The function first coerces a finite number into a Date, handles Date instances, then rejects anything whose type is not string. This site is the type-check rejection: the value could not even be considered for string parsing.","triggerScenarios":"Calling parseTimestamp(value, true) where value is null, undefined, NaN, a plain object (not Date), a boolean, or an array. Number inputs that are non-finite (NaN/Infinity) also fall through here because the `typeof input === 'number' && isFinite(input)` guard at line 121 is what coerces numbers; a non-finite number is left as-is and then fails the `typeof input !== 'string'` check.","commonSituations":"Passing model.value before it is initialized (null/undefined), binding :start/:end to an empty input field, feeding a moment/dayjs object instead of a native Date, or passing a timestamp computed from `new Date('invalid')` whose value is NaN. Happens when VCalendar/VCalendarDaily components receive an unparseable `start`/`end`/`now` prop.","solutions":["Pass a native Date, a finite number of ms since epoch, or a 'YYYY-MM-DD' string.","If the value may be absent, call parseTimestamp without `required` (or with required=false) so it returns null instead of throwing.","Guard the call with validateTimestamp(input) (exported from the same module) before passing required=true.","Ensure number inputs are finite; convert NaN-producing dates with `Number.isFinite(+d)` checks."],"exampleFix":"// before\nconst ts = parseTimestamp(maybeNull, true)\n\n// after\nimport { validateTimestamp, parseTimestamp } from 'vuetify/util/timestamp'\nif (validateTimestamp(input)) {\n  const ts = parseTimestamp(input, true)\n} else {\n  // use a default or skip\n}\n// or simply don't require it:\nconst ts = parseTimestamp(maybeNull) // returns null when absent","handlingStrategy":"validation","validationCode":"import { validateTimestamp, parseTimestamp } from 'vuetify/util/timestamp'\n\nfunction safeParse(input: unknown) {\n  if (input == null) return null\n  if (typeof input === 'number' && !Number.isFinite(input)) return null\n  if (!validateTimestamp(input)) {\n    throw new TypeError(`Invalid timestamp input: ${String(input)}`)\n  }\n  return parseTimestamp(input as any, true)\n}","typeGuard":"import { validateTimestamp, type VTimestampInput } from 'vuetify/util/timestamp'\nfunction isTimestampInput(v: unknown): v is VTimestampInput {\n  return validateTimestamp(v)\n}","tryCatchPattern":"try {\n  const ts = parseTimestamp(maybeBad, true)\n} catch (e) {\n  // message starts with '${input} is not a valid timestamp...'\n  if (e instanceof Error && /not a valid timestamp/.test(e.message)) {\n    // fallback to a default timestamp\n  } else throw e\n}","preventionTips":["Initialize date props to a concrete value or accept null and call parseTimestamp without required.","Never pass moment/dayjs objects; convert to native Date or ms first.","Guard non-finite numbers (NaN/Infinity) before passing them as ms-since-epoch."],"tags":["vcalendar","timestamp","input-validation","type-error"],"backgroundTag":null,"analyzedSha":"8d153908dffb7592eb389ddbfbab955a0ccc977f","analyzedAt":"2026-08-12T21:54:20.596Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}