1
0
Fork 0
forked from github/pelican

Support date format codes G, V, and u (used by ISO dates) (#2902)

This commit is contained in:
MinchinWeb 2021-07-13 01:35:22 -06:00 committed by GitHub
commit 332be6e5c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -513,6 +513,9 @@ class TestUtils(LoggedTestCase):
d = utils.SafeDatetime(2012, 8, 9)
self.assertEqual(utils.strftime(d, '%-d/%-m/%y'), '9/8/12')
d = utils.SafeDatetime(2021, 1, 8)
self.assertEqual(utils.strftime(d, '%G - %-V - %u'), '2021 - 1 - 5')
# test the output of utils.strftime in a different locale
# Turkish locale
@unittest.skipUnless(locale_available('tr_TR.UTF-8') or

View file

@ -50,7 +50,8 @@ def strftime(date, date_format):
'''
def strip_zeros(x):
return x.lstrip('0') or '0'
c89_directives = 'aAbBcdfHIjmMpSUwWxXyYzZ%'
# includes ISO date parameters added by Python 3.6
c89_directives = 'aAbBcdfGHIjmMpSUuVwWxXyYzZ%'
# grab candidate format options
format_options = '%[-]?.'