#17916: humanize naturaltime for large delta
----------------------------------+--------------------
     Reporter:  anonymous         |      Owner:  nobody
         Type:  New feature       |     Status:  new
    Component:  contrib.humanize  |    Version:  SVN
     Severity:  Normal            |   Keywords:
 Triage Stage:  Unreviewed        |  Has patch:  0
Easy pickings:  0                 |      UI/UX:  0
----------------------------------+--------------------
 The documentation (for the Django 1.4 development version) states that the
 naturaltime filter will default to a longer date format if the time delta
 is greater than 1 day.  The code for the naturaltime filter (just checked
 out from SVN) is as follows:

 {{{
     ...
     now = datetime.now(utc if is_aware(value) else None)
     if value < now:
         delta = now - value
         if delta.days != 0:
             return pgettext(
                 'naturaltime', '%(delta)s ago'
             ) % {'delta': defaultfilters.timesince(value)}
         elif delta.seconds == 0:
             return _(u'now')
         elif delta.seconds < 60:
             return ungettext(
                 u'a second ago', u'%(count)s seconds ago', delta.seconds
             ) % {'count': delta.seconds}
         ...
 }}}

 As can be seen above, if the delta is 1 day or more the value is obtained
 from timesince which will return a human readable string such as 1 year, 3
 months ago (with two time units).  If the delta is large, I think it would
 be better to provide a means to specify the desired date format.  I would
 rather a long date format like 10/3/2012 if the delta is large (rather
 than 1 month, 2 days ago for example).

 Btw I've reported this as a feature but even if this is not implemented I
 think that the documentation should be updated as it isn't really clear on
 the format of the fallback date.  It simply says "longer date format"
 which is not clear.  I was expecting something like dd/mm/yyyy or
 something similar.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17916>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to