Error thrown when attempting to use Temporal functionality that is not available in the current environment.
class TemporalNotAvailableError extends Error { constructor(message: string); readonly message: string; readonly name: string; stack?: string; static prepareStackTrace?: ( err: Error, stackTraces: CallSite[] ) => any; static stackTraceLimit: number; static captureStackTrace(targetObject: object, constructorOpt?: Function): void;}TemporalNotAvailableErrorCreates a new TemporalNotAvailableError instance.
stringTemporalNotAvailableErrorstringThe error message describing why Temporal is not available and how to resolve it. This message provides helpful guidance to developers about resolving the Temporal availability issue, including suggestions for polyfills and runtime requirements.
stringThe name of the error. Always set to 'TemporalNotAvailableError'. This property identifies the specific type of error and is useful for error handling and debugging purposes.
stringobjectOptional override for formatting stack traces
numbervoidCreate .stack property on a target object
objectFunctionvoidError thrown when attempting to use Temporal functionality that is not available in the current environment.
This error is thrown by the stub implementations of Temporal classes when no Temporal implementation is available (neither native Temporal nor a polyfill). It provides helpful guidance on how to resolve the issue by suggesting polyfill options.
import { Temporal } from '@agape/temporal';
try {
const date = Temporal.PlainDate.from('2025-09-19');
} catch (error) {
if (error instanceof TemporalNotAvailableError) {
console.error('Temporal is not available:', error.message);
// Handle the error appropriately
}
}
// Using a polyfill to resolve the error
import { Temporal as TemporalPolyfill } from '@js-temporal/polyfill';
import { setTemporal } from '@agape/temporal';
// Set the polyfill
setTemporal(TemporalPolyfill);
// Now Temporal operations will work
const now = Temporal.PlainDateTime.from('2025-09-19T10:00');
