diff --git a/backend/api/management/commands/fix_timestamps.py b/backend/api/management/commands/fix_timestamps.py new file mode 100644 index 00000000..6b7a5f84 --- /dev/null +++ b/backend/api/management/commands/fix_timestamps.py @@ -0,0 +1,20 @@ +from datetime import timezone +from django.core.management.base import BaseCommand +from api.models import Character, Notification + + +class Command(BaseCommand): + help = 'Fix all the Timestamps in the DB that are missing tzinfo' + + def handle(self, *args, **options): + for obj in Character.objects.all(): + if obj.created.tzinfo is None: + self.stdout.write(f'Updating created stamp for {obj}') + obj.created = obj.created.astimezone(timezone.utc) + obj.save() + + for obj in Notification.objects.all(): + if obj.timestamp.tzinfo is None: + self.stdout.write(f'Updating timestamp for {obj}') + obj.timestamp = obj.timestamp.astimezone(timezone.utc) + obj.save() diff --git a/backend/backend/settings_live.py b/backend/backend/settings_live.py index bbaae609..c97d4337 100644 --- a/backend/backend/settings_live.py +++ b/backend/backend/settings_live.py @@ -133,6 +133,14 @@ }, } +# Internationalization +# https://docs.djangoproject.com/en/3.1/topics/i18n/ +LANGUAGE_CODE = 'en-us' +TIME_ZONE = 'UTC' +USE_I18N = True +USE_L10N = True +USE_TZ = True + # Sentry for errors as well def sampler(context): # Always inherit parent context diff --git a/frontend/src/components/modals/changelog.vue b/frontend/src/components/modals/changelog.vue index 03ee6ae9..ace81f2d 100644 --- a/frontend/src/components/modals/changelog.vue +++ b/frontend/src/components/modals/changelog.vue @@ -14,6 +14,9 @@

{{ version }}

expand_more Minor Changes expand_more

Loot Tracker Greed Boxes will always have every Character in them, even if they don't have a BIS list, just for QoL.

+ +
expand_more Bugfixes expand_more
+

Fixed an issue where Notification timestamps were not stored in UTC, causing issues for displaying them in other timezones.