mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #1446 from avaris/enhanced_strftime
Fixes #1395: extends pelican.utils.strftime with `-` prefix to strip leading zeros
This commit is contained in:
commit
1fae9534d5
3 changed files with 33 additions and 5 deletions
|
|
@ -283,6 +283,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