Sync moment and Django formats for PT and TR

Fixes #498 and #532
This commit is contained in:
Christopher C. Wells 2023-02-11 17:39:36 -08:00
parent b9c86c8df8
commit 1d9577a192
5 changed files with 22 additions and 0 deletions

View File

View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from django.conf.locale.pt import formats
# Limit datetime input formats to those support by moment.
formats_supported = list(
filter(
lambda dt_format: not dt_format.startswith("%Y-%m-%d"),
formats.DATETIME_INPUT_FORMATS,
)
)
DATETIME_INPUT_FORMATS = formats_supported

View File

View File

@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
from django.conf.locale.tr import formats
# Add formats supported by moment.
DATETIME_INPUT_FORMATS = [
"%d.%m.%Y %H:%M:%S",
"%d.%m.%Y %H:%M",
*formats.DATETIME_INPUT_FORMATS,
]

View File

@ -198,6 +198,8 @@ LANGUAGES = [
USE_L10N = True USE_L10N = True
FORMAT_MODULE_PATH = ["babybuddy.formats"]
# Custom setting that can be used to override the locale-based time set by # Custom setting that can be used to override the locale-based time set by
# USE_L10N _for specific locales_ to use 24-hour format. In order for this to # USE_L10N _for specific locales_ to use 24-hour format. In order for this to
# work with a given locale it must be set at the FORMAT_MODULE_PATH with # work with a given locale it must be set at the FORMAT_MODULE_PATH with