mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fixes #1395: extends pelican.utils.strftime with - prefix to strip leading zeros
Adds the ability to use `-` prefix with C89 format codes to strip any leading zeros.
This commit is contained in:
parent
a3c8fca1db
commit
7c3cc8fc0d
3 changed files with 33 additions and 5 deletions
|
|
@ -280,6 +280,13 @@ class TestUtils(LoggedTestCase):
|
|||
self.assertEqual(utils.strftime(d, '%d/%m/%Y Øl trinken beim Besäufnis'),
|
||||
'29/08/2012 Øl trinken beim Besäufnis')
|
||||
|
||||
# alternative formatting options
|
||||
self.assertEqual(utils.strftime(d, '%-d/%-m/%y'), '29/8/12')
|
||||
self.assertEqual(utils.strftime(d, '%-H:%-M:%-S'), '0:0:0')
|
||||
|
||||
d = utils.SafeDatetime(2012, 8, 9)
|
||||
self.assertEqual(utils.strftime(d, '%-d/%-m/%y'), '9/8/12')
|
||||
|
||||
|
||||
# test the output of utils.strftime in a different locale
|
||||
# Turkish locale
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue