angular/components · error · Error
Method not implemented
Error message
Method not implemented
What it means
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.
Source
Thrown at src/material/core/datetime/date-adapter.ts:237
throw new Error(NOT_IMPLEMENTED);
}
/**
* Gets the seconds component of the given date.
* @param date The date to extract the seconds from.
*/
getSeconds(date: D): number {
throw new Error(NOT_IMPLEMENTED);
}
/**
* Parses a date with a specific time from a user-provided value.
* @param value The value to parse.
* @param parseFormat The expected format of the value being parsed
* (type is implementation-dependent).
*/
parseTime(value: any, parseFormat: any): D | null {
throw new Error(NOT_IMPLEMENTED);
}
/**
* Adds an amount of seconds to the specified date.
* @param date Date to which to add the seconds.
* @param amount Amount of seconds to add to the date.
*/
addSeconds(date: D, amount: number): D {
throw new Error(NOT_IMPLEMENTED);
}
/**
* Given a potential date object, returns that same date object if it is
* a valid date, or `null` if it's not a valid date.
* @param obj The object to check.
* @returns A date or `null`.
*/
getValidDateOrNull(obj: unknown): D | null {View on GitHub (pinned to 0411926e7d)
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
Example fix
// before
class MyAdapter extends DateAdapter<Date> {
// parseTime missing
}
// after
class MyAdapter extends DateAdapter<Date> {
parseTime(value: any, parseFormat: any): Date | null {
return this.parse(value, parseFormat); // or real parsing logic
}
} Defensive patterns
Strategy: validation
Validate before calling
function hasParseTime(a: unknown): a is DateAdapter<unknown> & { parseTime(v: any, f: any): unknown } {
return !!a && typeof (a as any).parseTime === 'function';
}
if (!hasParseTime(adapter)) throw new Error('Adapter must implement parseTime'); Type guard
function implementsParseTime(a: any): a is { parseTime: (v: any, f: any) => any } {
return a != null && typeof a.parseTime === 'function';
} Try / catch
try {
const time = adapter.parseTime(value, format);
} catch (e) {
if (String(e?.message).includes('Method not implemented')) {
throw new Error('Configured DateAdapter does not implement parseTime; use MatNativeDateModule or implement parseTime in your adapter');
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- NOT_IMPLEMENTED
- Could not find file for path: ${path}
- Attempting to attach an unknown Portal type. BasePortalOutle
- Unable to read directory in virtual file system host. This m
- Cannot retrieve popup content because the combobox is closed
AI-assisted analysis of angular/components@0411926e7d (2026-08-31).
Data as JSON: /api/errors/957711588e04326a.
Report an issue: GitHub.