diff --git a/tailbone/util.py b/tailbone/util.py index aea29342..85918330 100644 --- a/tailbone/util.py +++ b/tailbone/util.py @@ -100,7 +100,7 @@ def pretty_datetime(config, value): 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 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. 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: kwargs['c'] = six.text_type(value)