comparison mercurial/templatefilters.py @ 9722:4d9dea174b84

templater: readable dates older than 24 months revert to ISO8601 (issue1006)
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 05 Nov 2009 15:19:54 +0100
parents 1d75c683ada1
children 25e572394f5c
comparison
equal deleted inserted replaced
9721:1d75c683ada1 9722:4d9dea174b84
38 then = date[0] 38 then = date[0]
39 if then > now: 39 if then > now:
40 return 'in the future' 40 return 'in the future'
41 41
42 delta = max(1, int(now - then)) 42 delta = max(1, int(now - then))
43 if delta > agescales[0][1] * 2:
44 return util.shortdate(date)
45
43 for t, s in agescales: 46 for t, s in agescales:
44 n = delta // s 47 n = delta // s
45 if n >= 2 or s == 1: 48 if n >= 2 or s == 1:
46 return '%s ago' % fmt(t, n) 49 return '%s ago' % fmt(t, n)
47 50