Commit c2c46708 authored by Jérome Perrin's avatar Jérome Perrin

base: reimplement date formatting for invoice printout

Do not rely on DateTime.strftime which does fails on dates <= 1900.
This simple case does not need all the features of strftime and can be
implemented inline.
parent 08304770
......@@ -63,13 +63,15 @@ def getSocialCapital(reg_cap):
preferred_date_order = context.getPortalObject().portal_preferences\
.getPreferredDateOrder() or 'ymd'
separator = '/'
def getOrderedDate(date):
if date is None:
return ''
pattern = separator.join(['%%%s' % s for s in list(preferred_date_order)])
pattern = pattern.replace('y', 'Y')
return date.strftime(pattern)
date_parts = {
'y': '%04d' % date.year(),
'm': '%02d' % date.month(),
'd': '%02d' % date.day(),
}
return '/'.join([date_parts[part] for part in preferred_date_order])
def getPaymentConditionText(order):
if 'custom' == order.getPaymentConditionTradeDate():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment