Refs -- Added test for datetime_safe usage in SelectDateWidget.value_from_datadict().
@@ -477,6 +477,12 @@ class SelectDateWidgetTest(WidgetTest):
w.value_from_datadict({'date_year': '1899', 'date_month': '8', 'date_day': '13'}, {}, 'date'),
'13-08-1899',
)
+ # And years before 1000 (demonstrating the need for datetime_safe).
+ w = SelectDateWidget(years=('0001',))
+ self.assertEqual(
+ w.value_from_datadict({'date_year': '0001', 'date_month': '8', 'date_day': '13'}, {}, 'date'),
+ '13-08-0001',
+ )
def test_format_value(self):
valid_formats = [
