{"record":{"id":"957711588e04326a","repo":"angular/components","slug":"method-not-implemented","errorCode":null,"errorMessage":"Method not implemented","messagePattern":"Method not implemented","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/material/core/datetime/date-adapter.ts","lineNumber":237,"sourceCode":"    throw new Error(NOT_IMPLEMENTED);\n  }\n\n  /**\n   * Gets the seconds component of the given date.\n   * @param date The date to extract the seconds from.\n   */\n  getSeconds(date: D): number {\n    throw new Error(NOT_IMPLEMENTED);\n  }\n\n  /**\n   * Parses a date with a specific time from a user-provided value.\n   * @param value The value to parse.\n   * @param parseFormat The expected format of the value being parsed\n   *     (type is implementation-dependent).\n   */\n  parseTime(value: any, parseFormat: any): D | null {\n    throw new Error(NOT_IMPLEMENTED);\n  }\n\n  /**\n   * Adds an amount of seconds to the specified date.\n   * @param date Date to which to add the seconds.\n   * @param amount Amount of seconds to add to the date.\n   */\n  addSeconds(date: D, amount: number): D {\n    throw new Error(NOT_IMPLEMENTED);\n  }\n\n  /**\n   * Given a potential date object, returns that same date object if it is\n   * a valid date, or `null` if it's not a valid date.\n   * @param obj The object to check.\n   * @returns A date or `null`.\n   */\n  getValidDateOrNull(obj: unknown): D | null {","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/material/core/datetime/date-adapter.ts#L219-L255","documentation":"The abstract DateAdapter base class declares parseTime but provides no implementation; it throws 'Method not implemented' to force concrete adapters (NativeDateAdapter, MomentDateAdapter, etc.) to override it. Hitting this means the code path executed against the abstract base class itself, or against a custom adapter that failed to implement parseTime. It is a developer-error sentinel, not a runtime data problem.","triggerScenarios":"Calling parseTime on a DateAdapter instance whose class does not override parseTime — e.g. instantiating DateAdapter directly, extending DateAdapter without implementing parseTime, or using a custom adapter that implements the old interface (parseTime was added later, so older custom adapters lack it).","commonSituations":"Writing a custom date adapter and forgetting parseTime; upgrading Angular Material so the abstract class gains new required methods (parseTime, addSeconds) that an existing custom adapter never implemented; tests injecting a stub adapter that only implements some methods.","solutions":["Use a concrete adapter (NativeDateAdapter via MatNativeDateModule, or MomentDateAdapter via MatMomentDateModule) instead of DateAdapter itself","If you have a custom adapter, implement parseTime(value, parseFormat) returning D | null","If a third-party adapter broke after a Material upgrade, update it to match the current DateAdapter abstract interface","In tests, use a stub that extends an existing adapter rather than DateAdapter"],"exampleFix":"// before\nclass MyAdapter extends DateAdapter<Date> {\n  // parseTime missing\n}\n// after\nclass MyAdapter extends DateAdapter<Date> {\n  parseTime(value: any, parseFormat: any): Date | null {\n    return this.parse(value, parseFormat); // or real parsing logic\n  }\n}","handlingStrategy":"validation","validationCode":"function hasParseTime(a: unknown): a is DateAdapter<unknown> & { parseTime(v: any, f: any): unknown } {\n  return !!a && typeof (a as any).parseTime === 'function';\n}\nif (!hasParseTime(adapter)) throw new Error('Adapter must implement parseTime');","typeGuard":"function implementsParseTime(a: any): a is { parseTime: (v: any, f: any) => any } {\n  return a != null && typeof a.parseTime === 'function';\n}","tryCatchPattern":"try {\n  const time = adapter.parseTime(value, format);\n} catch (e) {\n  if (String(e?.message).includes('Method not implemented')) {\n    throw new Error('Configured DateAdapter does not implement parseTime; use MatNativeDateModule or implement parseTime in your adapter');\n  }\n  throw e;\n}","preventionTips":["Never inject the abstract DateAdapter directly; provide a concrete adapter module","When writing a custom adapter, implement every abstract member (run a compile check — abstract methods are enforced by TypeScript)","After Material upgrades, build your project to catch newly added abstract methods","In tests, extend NativeDateAdapter rather than stubbing DateAdapter from scratch"],"tags":["angular","typescript","date-adapter","abstract-method"],"backgroundTag":"method-not-implemented","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}