gws.plugin.model_validator.date_range¶
Validator for date ranges.
Checks that the field value is a date between min and max, both
inclusive. The bounds are model values, so they can be fixed dates or
computed, e.g. the current date. A bound that computes to a string is
compared as an ISO date string. A value that is not a date fails the check.
Example:
fields+ {
name "inspection_date"
type "date"
validators+ {
type "dateRange"
min { type "static" value "2000-01-01" }
max { type "currentTimestamp" }
}
}
Source code: gws.plugin.model_validator.date_range
Package Contents¶
- class gws.plugin.model_validator.date_range.Config¶
Bases:
gws.base.model.validator.ConfigChecks that a date lies within a range.
- max: gws.ext.config.modelValue | None¶
Latest allowed date.
- min: gws.ext.config.modelValue | None¶
Earliest allowed date.
- class gws.plugin.model_validator.date_range.Object¶
Bases:
gws.base.model.validator.ObjectDate range validator object.
- maxVal: gws.ModelValue | None¶
Value that computes the latest allowed date.
- minVal: gws.ModelValue | None¶
Value that computes the earliest allowed date.
- configure()¶
- validate(field, feature, mc)¶