slashmili / django-jalali

Jalali DateField support for Django model
http://pypi.python.org/pypi/django_jalali
BSD 3-Clause "New" or "Revised" License
253 stars 52 forks source link

jDateField fails to validate Persian months in case month=2 and day=31 #90

Closed 7xMind closed 5 years ago

7xMind commented 5 years ago
slashmili commented 5 years ago

Hi @7xMind, What's wrong with 31st of Ordibehesht?

It's always 31 days, isn't?

HodaSadatJafari commented 5 years ago

@slashmili In persian calender yes. But, in greforian calender 31.2(dd/mm) means February 31th which is not a valid date. Gregorian Calender does not have 31.2. Given that you call the django DateField validation to validate the input, it triggers the ValidationError. Put differently, if I want to put Ordibehesht 31th, your JalaliDateField sees it as February 31th which is not a valid Gregorian date.

slashmili commented 5 years ago

Hi @HodaJafari

This is an example record that I saved and I don't see that django complains about the date.

Screenshot-1397-02-31

Can you provide screenshot or stacktrace that provides more information?

HodaSadatJafari commented 5 years ago

Thank you @slashmili Our issue is resolved. For future reference: We hadn't included objects = jmodels.jManager() in our model.

slashmili commented 5 years ago

@7xMind I close this issue for now, feel free to open it with more debugging information