hello, I'm using Plone 4.3.15
The widget's default year range is automatically set between -10 years and +10 years relative to a date.
I tried making a widget factory for the date field and setting the year range
@implementer(IFieldWidget)
def DateFieldWidget(field, request):
widget = FieldWidget(field, DateWidget(request))
start = -(date.today().year - 1930)
end = 1
widget.years_range = (start, end)
return widget
date_affiliation = schema.Date(
title=_(u'Date of affiliation'),
min=START_REPUBLIC_BRAZIL,
required=True,
form.widget(birthday=DateFieldWidget)
birthday = schema.Date(
title=_(u'Birthday'),
description=_(u''),
required=True,
max=MAX_BIRTHDAY,
min=MIN_BIRTHDAY,
constraint=check_birthday,
)
This only works in an add form, where it sets between a year, in the example I provided 1930 and 1 years from today's year. In the edit form, the first and last years available for selection are off.
the edit form, when I try to update change the setted value.
(I'm trying to register and edit one birthday)
thanks