Skip to content

dateColumn

function dateColumn<F>(options?): TableColumnSpec<DatePresetValue, "date", NoInfer<F>>;

Defined in: filters/tanstack-table.ts:466

A date preset picker: the value is a DatePresetValue (e.g. “this month”, or a between range with end) and becomes a date filter. With timeZone, the value may omit it (and fromFilter leaves it out again when it matches). The preset is resolved later by your resolveDate.

Type Parameter Default type
F extends string | undefined undefined
Parameter Type
options? FieldOption<F> & object

TableColumnSpec<DatePresetValue, "date", NoInfer<F>>

import { dateColumn } from "@xtandard/lib/filters/tanstack-table";
const createdAt = dateColumn({ timeZone: "Europe/Madrid" });
createdAt.toFilter({ operator: "is", unit: "month", anchor: "2026-02-01T00:00:00" });
// → { kind: "date", operator: "is", unit: "month", timeZone: "Europe/Madrid", anchor: "2026-02-01T00:00:00" }
createdAt.toFilter({ operator: "is", unit: "fortnight", anchor: "2026-02-01T00:00:00" }); // → null