predicate
Description
Optional. A date part extractor for date fields in FilterEditorUsage
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
import { getData } from "../data";
import { Field } from "@svar-ui/react-core";
import { FilterEditor, getOptions } from "@svar-ui/react-filter";
export default function PredicateExample() {
const { data } = getData();
return (
`<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: