Date Selection

The date selection field was designed to support the UI requirement of allowing users to select a date using multi-select input fields. The DateSelect field extends the zope.schema.Date field merely by a few additional attributes.

>>> from z3c.schema.dateselect import field

the first attribute is the range of years that will be offered to the user:

>>> birthday = field.DateSelect(
...     title=u'Birthday',
...     yearRange=list(range(1920, 2007)))

In this case the user will be offered all years from 1920 to 2007.

>>> birthday.yearRange
[1920, ..., 2006]

The second attribute allows you to specify an initial date for the selection:

>>> import datetime
>>> birthday = field.DateSelect(
...     title=u'Birthday',
...     yearRange=range(1920, 2007),
..., 1, 1))
>>> birthday.initialDate, 1, 1)

And this is really it. Please read the documentation on the Date for more information.


class z3c.schema.dateselect.IDateSelect[source]

Bases: zope.schema.interfaces.IDate

class z3c.schema.dateselect.DateSelect(yearRange=None, initialDate=None, **kw)[source]

Bases: zope.schema._field.Date