Initial commit
This commit is contained in:
38
env/lib/python3.10/site-packages/wagtail/admin/datetimepicker.py
vendored
Normal file
38
env/lib/python3.10/site-packages/wagtail/admin/datetimepicker.py
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Adapted from https://djangosnippets.org/snippets/10563/
|
||||
# original author bernd-wechner
|
||||
|
||||
|
||||
def to_datetimepicker_format(python_format_string):
|
||||
"""
|
||||
Given a python datetime format string, attempts to convert it to
|
||||
the nearest PHP datetime format string possible.
|
||||
"""
|
||||
python2PHP = {
|
||||
"%a": "D",
|
||||
"%A": "l",
|
||||
"%b": "M",
|
||||
"%B": "F",
|
||||
"%c": "",
|
||||
"%d": "d",
|
||||
"%H": "H",
|
||||
"%I": "h",
|
||||
"%j": "z",
|
||||
"%m": "m",
|
||||
"%M": "i",
|
||||
"%p": "A",
|
||||
"%S": "s",
|
||||
"%U": "",
|
||||
"%w": "w",
|
||||
"%W": "W",
|
||||
"%x": "",
|
||||
"%X": "",
|
||||
"%y": "y",
|
||||
"%Y": "Y",
|
||||
"%Z": "e",
|
||||
}
|
||||
|
||||
php_format_string = python_format_string
|
||||
for py, php in python2PHP.items():
|
||||
php_format_string = php_format_string.replace(py, php)
|
||||
|
||||
return php_format_string
|
||||
Reference in New Issue
Block a user