Mercurial > hg > MPIWGWeb
diff SrvTxtUtils.py @ 137:e0b343cee9dd
cleanup.
author | casties |
---|---|
date | Fri, 31 May 2013 14:48:28 +0200 |
parents | 2e2dd6a5ab26 |
children | 485bf377913a |
line wrap: on
line diff
--- a/SrvTxtUtils.py Fri May 31 14:11:13 2013 +0200 +++ b/SrvTxtUtils.py Fri May 31 14:48:28 2013 +0200 @@ -13,7 +13,7 @@ import xml.etree.ElementTree as ET -srvTxtUtilsVersion = "1.9.1" +srvTxtUtilsVersion = "1.9.2" map_months = {'en': [u"", u"January", @@ -119,7 +119,7 @@ return map_months[lang][mon] -def getDateString(date=None, lang='en', withYear=True, abbrev=False): +def getDateString(date=None, lang='en', withYear=True, monthNames=True, abbrev=False): """Return formatted date string.""" ds = None if callable(date.day): @@ -134,14 +134,17 @@ year = date.year if lang.lower() == 'en': - ds = "%s, %s"%(getMonthName(month, lang), day) + ds = "%s %s"%(getMonthName(month, lang), day) + if withYear: + ds += ", %s"%year + + elif lang.lower() == 'de': + ds = "%s. %s"%(day, getMonthName(month, lang)) if withYear: ds += " %s"%year - - elif lang.lower() == 'de': - ds = "%s.%s."%(day, month) - if withYear: - ds += " %s"%year + + elif lang.lower() == 'iso': + ds = date.isoformat() return ds