Skip to content

isTemporalPlainDate

Checks if a value is a Temporal.PlainDate.

Uses instanceof when Temporal is available globally, and falls back to Symbol.toStringTag for environments without Temporal (e.g. browsers).

Available since v2.0.0

import { isTemporalPlainDate } from '@helpers4/guard';
// or, from the all-in-one package (same code, one install):
import { isTemporalPlainDate } from 'helpers4/guard';
isTemporalPlainDate(value: unknown): value is PlainDate
ParameterTypeDescription
valueunknownThe value to check

value is PlainDate — True if value is a Temporal.PlainDate

isTemporalPlainDate(Temporal.PlainDate.from('2025-01-19'))  // => true
isTemporalPlainDate(Temporal.Now.instant())                 // => false
isTemporalPlainDate(new Date())                             // => false

View source on GitHub