{"record":{"id":"40e3d0d370a9a457","repo":"vuetifyjs/vuetify","slug":"v-cannot-be-parsed-into-date-format-specifica","errorCode":null,"errorMessage":"[${v}] cannot be parsed into date format specification","messagePattern":"\\[(.+?)\\] cannot be parsed into date format specification","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vuetify/src/composables/dateFormat.ts","lineNumber":38,"sourceCode":"  ) { }\n\n  get format () {\n    return this.order.split('')\n      .map(sign => `${sign}${sign}`)\n      .join(this.separator)\n      .replace('yy', 'yyyy')\n  }\n\n  static canBeParsed (v: any) {\n    if (typeof v !== 'string') return false\n    const lowercase = v.toLowerCase()\n    return ['y', 'm', 'd'].every(sign => lowercase.includes(sign)) &&\n      ['/', '-', '.'].some(sign => v.includes(sign))\n  }\n\n  static parse (v: string) {\n    if (!DateFormatSpec.canBeParsed(v)) {\n      throw new Error(`[${v}] cannot be parsed into date format specification`)\n    }\n    const order = v.toLowerCase().split('')\n      .filter((c, i, all) => 'dmy'.includes(c) && all.indexOf(c) === i)\n      .join('')\n    const separator = ['/', '-', '.'].find(sign => v.includes(sign))!\n    return new DateFormatSpec(order, separator)\n  }\n}\n\nexport const makeDateFormatProps = propsFactory({\n  inputFormat: {\n    type: String,\n    validator: (v: string) => !v || DateFormatSpec.canBeParsed(v),\n  },\n}, 'date-format')\n\nexport function useDateFormat (props: DateFormatProps, locale: Ref<string>) {\n  const adapter = useDate()","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/vuetifyjs/vuetify/blob/8d153908dffb7592eb389ddbfbab955a0ccc977f/packages/vuetify/src/composables/dateFormat.ts#L20-L56","documentation":"Thrown by DateFormatSpec.parse() when canBeParsed(v) is false. canBeParsed requires the value be a string that, lowercased, contains 'y', 'm', and 'd' AND contains one of '/', '-', '.' as a separator. This drives VDateInput / locale date-input format parsing.","triggerScenarios":"Passing an `inputFormat` like 'YYYY' (missing m/d), 'YYYYMMDD' (no separator), 'MM-DD' (missing y), a non-string, or a format using unsupported separators (e.g. 'YYYY MM DD' with a space).","commonSituations":"Setting the `input-format` prop on VDateInput to an ISO-style 'YYYY-MM-DD' is fine, but locale strings like 'DD MMM YYYY', formats with words, or missing components fail. Also triggered by passing dayjs/date-fns tokens verbatim.","solutions":["Use a separator-delimited format containing y, m, and d (e.g. 'yyyy-MM-dd', 'dd/MM/yyyy', 'MM.dd.yyyy').","If you only have an ISO string, omit inputFormat and let the component use the default.","Pre-check with DateFormatSpec.canBeParsed(value) before assigning inputFormat."],"exampleFix":"// before\n<VDateInput input-format=\"YYYY\" />\n// or\n<VDateInput input-format=\"DD MMM YYYY\" />\n\n// after\n<VDateInput input-format=\"yyyy-MM-dd\" />","handlingStrategy":"validation","validationCode":"import { DateFormatSpec } from 'vuetify/composables/dateFormat'\n\nfunction safeInputFormat(fmt: string): string {\n  if (!DateFormatSpec.canBeParsed(fmt)) {\n    throw new TypeError(`inputFormat '${fmt}' must contain y/m/d and a /,-,or . separator`)\n  }\n  return fmt\n}","typeGuard":"import { DateFormatSpec } from 'vuetify/composables/dateFormat'\nfunction isParsableFormat(v: unknown): v is string {\n  return typeof v === 'string' && DateFormatSpec.canBeParsed(v)\n}","tryCatchPattern":"try {\n  DateFormatSpec.parse(maybeFmt)\n} catch (e) {\n  if (e instanceof Error && /cannot be parsed into date format/.test(e.message)) {\n    fmt = 'yyyy-MM-dd' // safe default\n  } else throw e\n}","preventionTips":["Restrict input-format to a known set of supported tokens.","Add a unit test for every locale format your app supports.","Do not feed dayjs/date-fns token strings; use Vuetify's y/m/d format."],"tags":["date","date-format","input-validation","config"],"backgroundTag":null,"analyzedSha":"8d153908dffb7592eb389ddbfbab955a0ccc977f","analyzedAt":"2026-08-12T21:54:20.596Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}