filternodes

filter.nodes.dateRange

dateRange(spec: DateRangeSpec): FilterHandle<DateRangeSpec>

Date range filter on a node property.

Hides nodes whose property value falls outside [after, before]. Accepts Date, ISO string, or millisecond timestamp inputs; the entry stores millisecond timestamps. Omitted bounds default to -Infinity / +Infinity. Invalid date strings fall back to the open bound. granularity is forwarded for downstream playback / UI alignment.

spec.propertystringNode property name to filter on.
spec.after Date | string | numberLower bound (inclusive). Accepts Date, ISO string, or ms timestamp.
spec.before Date | string | numberUpper bound (inclusive). Accepts Date, ISO string, or ms timestamp.
spec.granularity DateGranularityGranularity hint for playback / UI alignment (year/month/day/hour/minute/second).
spec.on string | string[] | '*'Restrict to a subset of node categories. Default: '*' (all).
spec.includeNull booleanKeep nodes missing the property. Default: true.
spec.invert booleanInvert pass/fail. Default: false.
spec.id stringOverride the auto-generated handle id.

Returns: FilterHandle<DateRangeSpec>

Example

const recent = api.filter.nodes.dateRange({
  property: "createdAt",
  after: "2024-01-01",
  before: new Date(),
  granularity: "day",
});

// Advance the window
recent.update({ after: "2024-06-01" });