module documentation

Undocumented

Function timesince Take two datetime objects and return the time between d and now as a nicely formatted string, e.g. "10 minutes". If d occurs after now, return "0 minutes".
Function timeuntil Like timesince, but return a string measuring the time until the given time.
Constant TIME_STRINGS Undocumented
Constant TIMESINCE_CHUNKS Undocumented
def timesince(d, now=None, reversed=False, time_strings=None, depth=2): (source)

Take two datetime objects and return the time between d and now as a nicely formatted string, e.g. "10 minutes". If d occurs after now, return "0 minutes". Units used are years, months, weeks, days, hours, and minutes. Seconds and microseconds are ignored. Up to `depth` adjacent units will be displayed. For example, "2 weeks, 3 days" and "1 year, 3 months" are possible outputs, but "2 weeks, 3 hours" and "1 year, 5 days" are not. `time_strings` is an optional dict of strings to replace the default TIME_STRINGS dict. `depth` is an optional integer to control the number of adjacent time units returned. Adapted from https://web.archive.org/web/20060617175230/http://blog.natbat.co.uk/archive/2003/Jun/14/time_since

def timeuntil(d, now=None, time_strings=None, depth=2): (source)

Like timesince, but return a string measuring the time until the given time.

TIME_STRINGS = (source)

Undocumented

Value
{'year': ngettext_lazy('%(num)d year', '%(num)d years', 'num'),
 'month': ngettext_lazy('%(num)d month', '%(num)d months', 'num'),
 'week': ngettext_lazy('%(num)d week', '%(num)d weeks', 'num'),
 'day': ngettext_lazy('%(num)d day', '%(num)d days', 'num'),
 'hour': ngettext_lazy('%(num)d hour', '%(num)d hours', 'num'),
 'minute': ngettext_lazy('%(num)d minute', '%(num)d minutes', 'num')}
TIMESINCE_CHUNKS = (source)

Undocumented

Value
((((60*60)*24)*365, 'year'),
 (((60*60)*24)*30, 'month'),
 (((60*60)*24)*7, 'week'),
 ((60*60)*24, 'day'),
 (60*60, 'hour'),
 (60, 'minute'))