slashmili / django-jalali

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

incorrect datatime value #241

Closed hosseincodes closed 2 months ago

hosseincodes commented 2 months ago

whenever i change my datetime model field from this created_at = models.DateTimeField(default=now, editable=False) to this created_at = jmodel.jDateTimeField(auto_now_add=True) i get this error: (1292, "incorrect datatime value: '2024-04-09 21:58:16.466673+03:30 for column'")

hosseincodes commented 2 months ago

it happens on mysql but not on local host

hramezani commented 2 months ago

Could you please share more info like: Django version Python version Django-Jalali version

Are you using the latest version of django-jalali? If not, could you please test the latest version?

hosseincodes commented 2 months ago

Django 5.0.3 Python 3.10.13 django-jalali 6.2.0

hramezani commented 2 months ago

Could you please provide more information?

when and where did you get this error?

It would be great to provide a test or sample project helping us to reproduce the problem

hosseincodes commented 2 months ago

The program worked without problems on the local host, but when I deployed it on the host and connected it to the database, I encountered this problem.

In the meantime, I noticed that when I used django-Jalali to record the time, the value was saved like this 2024-04-10 10:59:37.924497+03:30

But in the initial state and without problems, it is saved as follows 1402-12-29T14:41:02.919282+0330

As you can see, there is one more letter T in the initial state. Can this be a problem?

hramezani commented 2 months ago

Thanks @hosseincodes for the information.

Unfortunately, I can't reproduce the problem and I can't find the problem.

Let's keep the issue open to find a way to reproduce and fix the probelm

slashmili commented 2 months ago

Do you use the same version of MySQL on both local and in your server?

That's interesting, you are saying it was working and suddenly start to happen? What else did change? did you update any dependency ?

BTW I have a memory that we don't support mysql, or maybe I'm wrong that was this #86 which is closed now.

hosseincodes commented 2 months ago

I use sqlite on localhost and mysql on the server. nothing else changed and I have the exact error with the issue you mentioned. yes, it seems like django jalai doesn't support mysql. that would be great to fix this problem

slashmili commented 2 months ago

Yup, there is no MySQL support.

I'll close this ticket as a duplicate discussion we have in https://github.com/slashmili/django-jalali/discussions/147

Thanks for giving django-jalali a try and sorry that it wasn't clear from the beginning that it doesn't support MySQL, I'll update the readme to reflect that.

I'd like to suggest a few improvements to your approach to reporting issues. It would be helpful if you could specify the version you are using in future reports. Additionally, it seems there was an important detail omitted in your report: locally you are running SQLite, and on the server, you are running MySQL. Including such details can greatly assist in diagnosing issues more efficiently.