constrained_dates¶
- polyfactory.value_generators.constrained_dates.handle_constrained_date(faker: Faker, ge: date | None = None, gt: date | None = None, le: date | None = None, lt: date | None = None, tz: tzinfo | bool | None = datetime.timezone.utc) date[source]¶
Generates a date value fulfilling the expected constraints.
- Parameters:
faker¶ – An instance of faker.
lt¶ – Less than value.
le¶ – Less than or equal value.
gt¶ – Greater than value.
ge¶ – Greater than or equal value.
tz¶ – A timezone. When a boolean is passed (as used by
msgspec.Meta),Truemaps totimezone.utc(timezone-aware) andFalsemaps toNone(timezone-naive), matching the semantics ofmsgspec.Meta(tz=...).
- Returns:
A date instance.