Skip to main content
Parameter option for date parameters that can vary based on selection of another parameter. This class can be imported from the squirrels.parameter_options or the squirrels module.

Constructor

Creates a DateParameterOption object. Typically used in pyconfigs/parameters.py.

Examples

A DateParameterOption object is created in the pyconfigs/parameters.py file. It must be created in a function decorated with the create_with_options factory method from DateParameter.

Usage example in parameters.py

In addition, the following are some additional examples for creating a DateParameterOption object.

Using string dates with custom format

This example shows how to specify dates as strings with a custom date format instead of using datetime.date objects.

Setting up cascading parameters with varying date ranges

This example shows how to create date options that change their constraints based on the selection of a parent parameter (e.g., different fiscal years with different date ranges).

Restricting date ranges by user groups

This example shows how to provide different date range constraints based on user access levels using the user_groups parameter.
If custom user fields are defined in pyconfigs/user.py, then they can be used to restrict date constraints as well. To do so, the user_attribute argument must be prefixed with custom_fields..