The issue is pretty simple, but I can't for the life of me find any information on it. Based on my internet searches, it seems like this should be a non-issue; Django should be doing this automatically.
My issue is that ever since DST began, Django has been converting times to displays on the webpages 1 hour before the times should be. I say converting to because I've enabled "USE_TZ" in settings, so the times are being saved to the database in UTC, but the times are incorrectly converted to EST as they are one hour behind.
What could be causing this?
Here's an example:
This is the model.
class Chat(models.Model):
chat_id = models.AutoField(primary_key=True)
chat_user = models.ForeignKey(UserExt, null=True, on_delete=models.SET_NULL)
chat_time = models.DateTimeField(auto_now_add=True)
chat_type = models.CharField(default="chat", blank=False, null=False, max_length=20)
chat_message = models.TextField()
This is an example of a model being saved to the database
new_chat = ClubChat()
new_chat.chat_user = self.user
new_chat.chat_message = message
new_chat.chat_destination = self.club
new_chat.save()
And this is an example of a webpage that displays the date/time
<tr {% if chat.chat_type == 'info' %} class="joinleavemessage"{% endif %}>
<td>
{% if chat.chat_user %}<p>{{ chat.chat_user }}</p>{% endif %}
<p>{{ chat.chat_time|date:'m/d/Y h:i A' }}</p>
</td>
<td>
<p>{{ chat.chat_message }}</p>
</td>
</tr>
This issue is site-wide, so this isn't the only example.