diff --git a/core/utils.py b/core/utils.py index e817a750..09b9d7f5 100644 --- a/core/utils.py +++ b/core/utils.py @@ -6,13 +6,16 @@ from django.utils.translation import ngettext def child_age_string(duration): """Monkey patch timesince function to day precision only. """ + default_timesine_chunks = timesince.TIMESINCE_CHUNKS timesince.TIMESINCE_CHUNKS = ( (60 * 60 * 24 * 365, 'year'), (60 * 60 * 24 * 30, 'month'), (60 * 60 * 24 * 7, 'week'), (60 * 60 * 24, 'day'), ) - return timesince.timesince(duration) + ts = timesince.timesince(duration) + timesince.TIMESINCE_CHUNKS = default_timesine_chunks + return ts def duration_string(duration, precision='s'):