Allow rendering of "raw" datetime as ISO date
sometimes a full timestamp isn't that helpful
This commit is contained in:
parent
93a44d83d2
commit
99f69c13d2
|
@ -100,7 +100,7 @@ def pretty_datetime(config, value):
|
||||||
c=humanize.naturaltime(time_ago))
|
c=humanize.naturaltime(time_ago))
|
||||||
|
|
||||||
|
|
||||||
def raw_datetime(config, value, verbose=False):
|
def raw_datetime(config, value, verbose=False, as_date=False):
|
||||||
"""
|
"""
|
||||||
Formats a datetime as a "raw" human-readable string, with a tooltip
|
Formats a datetime as a "raw" human-readable string, with a tooltip
|
||||||
showing the more human-friendly "time since" equivalent.
|
showing the more human-friendly "time since" equivalent.
|
||||||
|
@ -129,7 +129,10 @@ def raw_datetime(config, value, verbose=False):
|
||||||
|
|
||||||
# Avoid strftime error when year falls before epoch.
|
# Avoid strftime error when year falls before epoch.
|
||||||
if value.year >= 1900:
|
if value.year >= 1900:
|
||||||
kwargs['c'] = value.strftime('%Y-%m-%d %I:%M:%S %p')
|
if as_date:
|
||||||
|
kwargs['c'] = value.strftime('%Y-%m-%d')
|
||||||
|
else:
|
||||||
|
kwargs['c'] = value.strftime('%Y-%m-%d %I:%M:%S %p')
|
||||||
else:
|
else:
|
||||||
kwargs['c'] = six.text_type(value)
|
kwargs['c'] = six.text_type(value)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue