Skip to main content

predicate

Description​

Optional. A date part extractor for date fields in FilterEditor

Usage​

predicate?: "month" | "year";

Parameters​

  • predicate - (optional) defines which part of the date will be extracted when filtering:
    • "month" – extracts the month part of a date field
    • "year" – extracts the year part of a date field

If not specified, the full date value is used for filtering.

Example​

<script>
import { getData } from "../data";
import { Field } from "@svar-ui/svelte-core";
import { FilterEditor, getOptions } from "@svar-ui/svelte-filter";

const { data } = getData();
</script>

<Field label="Filter with 'month' predicate">
<FilterEditor
field="start"
options={getOptions(data, "start", { predicate: "month" })}
type="number"
filter="less"
value="10"
predicate="month"
/>
</Field>

Related articles: