slashmili / django-jalali

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

"Enter a valid date." error when selecting shahrivar 31st. #56

Closed mrezzamoradi closed 7 years ago

mrezzamoradi commented 7 years ago

I have a model named Semester and a form like this:

class Semester(models.Model):
    title = models.CharField(max_length=128, verbose_name=_('title'), unique=True)
    start_date = jmodels.jDateField(verbose_name=_('start date'))
    end_date = jmodels.jDateField(verbose_name=_('end date'))

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = _("semester")
        verbose_name_plural = _("semesters")
        ordering = ('-start_date',)
class SemesterForm(forms.ModelForm):

    class Meta:
        model = Semester
        fields = ['title', 'start_date', 'end_date']

in the admin page, I encounter a Enter a valid date_ error message when I choose to set 13xx-06-31 as either start date or end date.

I use django-jalali 2.4.4 and jdatetime 1.9.0 with django 1.10.5.

image

slashmili commented 7 years ago

@mrezzamoradi check the example project

Looks ok for me

save time

mrezzamoradi commented 7 years ago

Thanks @slashmili. I tried this test on other django versions and the result is the same. I found that it checks the date against Georgian calendar and produces an invalid error message, like this:

image

slashmili commented 7 years ago

@mrezzamoradi Have you tried this example? https://github.com/slashmili/django-jalali/tree/master/jalali_test

mrezzamoradi commented 7 years ago

@slashmili yes I did, here it is:

image

image

mrezzamoradi commented 7 years ago

Oh, I updated django-jalali 2.4.4 to django-jalali 2.4.5 and the problem is fixed.

Thanks