vuetifyjs/vuetify · error · Error

${input} is not a valid timestamp. It must be a Date, number

Error message

${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.

What it means

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.

Source

Thrown at packages/vuetify/src/components/VCalendar/util/timestamp.ts:137

export function parseTimestamp (input: VTimestampInput, required: true, now?: CalendarTimestamp): CalendarTimestamp
export function parseTimestamp (input: VTimestampInput | null, required = false, now?: CalendarTimestamp | null): CalendarTimestamp | null {
  if (typeof input === 'number' && isFinite(input)) {
    input = new Date(input)
  }

  if (input instanceof Date) {
    const date: CalendarTimestamp = parseDate(input)

    if (now) {
      updateRelative(date, now, date.hasTime)
    }

    return date
  }

  if (typeof input !== 'string') {
    if (required) {
      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.`)
    }
    return null
  }

  // YYYY-MM-DD hh:mm:ss
  const parts = PARSE_REGEX.exec(input)

  if (!parts) {
    if (required) {
      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.`)
    }

    return null
  }

  const timestamp: CalendarTimestamp = {
    date: input,
    time: '',

View on GitHub (pinned to 8d153908df)

Solutions

  1. Pass a native Date, a finite number of ms since epoch, or a 'YYYY-MM-DD' string.
  2. If the value may be absent, call parseTimestamp without `required` (or with required=false) so it returns null instead of throwing.
  3. Guard the call with validateTimestamp(input) (exported from the same module) before passing required=true.
  4. Ensure number inputs are finite; convert NaN-producing dates with `Number.isFinite(+d)` checks.

Example fix

// before
const ts = parseTimestamp(maybeNull, true)

// after
import { validateTimestamp, parseTimestamp } from 'vuetify/util/timestamp'
if (validateTimestamp(input)) {
  const ts = parseTimestamp(input, true)
} else {
  // use a default or skip
}
// or simply don't require it:
const ts = parseTimestamp(maybeNull) // returns null when absent
Defensive patterns

Strategy: validation

Validate before calling

import { validateTimestamp, parseTimestamp } from 'vuetify/util/timestamp'

function safeParse(input: unknown) {
  if (input == null) return null
  if (typeof input === 'number' && !Number.isFinite(input)) return null
  if (!validateTimestamp(input)) {
    throw new TypeError(`Invalid timestamp input: ${String(input)}`)
  }
  return parseTimestamp(input as any, true)
}

Type guard

import { validateTimestamp, type VTimestampInput } from 'vuetify/util/timestamp'
function isTimestampInput(v: unknown): v is VTimestampInput {
  return validateTimestamp(v)
}

Try / catch

try {
  const ts = parseTimestamp(maybeBad, true)
} catch (e) {
  // message starts with '${input} is not a valid timestamp...'
  if (e instanceof Error && /not a valid timestamp/.test(e.message)) {
    // fallback to a default timestamp
  } else throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vuetifyjs/vuetify@8d153908df (2026-08-12). Data as JSON: /api/errors/0a4f8f5c8cc113b1. Report an issue: GitHub.