Roundup Tracker - Issues

Issue 2550889

classification
Title: Introduce HTMLDate.periodof(), Interval.period() functions
Type: Severity: normal
Components: Versions:
process
Status: pending Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: antmail, rouilj
Priority: Keywords: patch

Created on 2015-06-18 11:31 by antmail, last changed 2016-06-18 04:14 by rouilj.

Files
File name Uploaded Description Edit Remove
period.patch antmail, 2015-06-18 11:31
Messages
msg5322 Author: [hidden] (antmail) Date: 2015-06-18 11:31
Outputing period (duration) from a template seems to be rather complex.
Also, 'pretty' format with words 'ago', 'in' may be a problem for
outputing duration only .

I create some functions for simplifying this task:
HTMLDate
def periodof(self, pretty=1, othdate='.'):
    """ Render the duration between this date and other date (default is
now). If the "pretty" flag is true, then make the display human readable."""

Interval
def period()
# return interval in human readable format such as "1 month", "2 week" etc.

Use it in templates as:
issue.closedate.periodof(othdate = issue.creation)
msg5331 Author: [hidden] (rouilj) Date: 2015-06-28 03:52
Looks like some doc updates to customising.txt are needed
to document the new methods (I searched for reldate to find the
correct location).

Is there anyplace else we need docs?

(I don't think ./doc/html_extra/spec.html needs update, again a historic
document)

Also the templating tests probably need stub definitions
for each of the classes.

Does anybody see aybode se other issues for this patch?
msg5606 Author: [hidden] (rouilj) Date: 2016-06-18 04:14
Hi Anthony:

Your patch causes test_dates.py to fail. It returns "in tomorrow" rather
than just "tomorrow" for the interval 1d.

Also intervals "-1d" produces "yesterday ago" but should
return "yesterday".
Also the following intervals fail

        ae('00:00:30', 'in a moment')
        ae('-00:00:30', 'just now')

with "in in a moment" and "just now ago".

They really aren't periods, more a description of the interval
with respect to now.

Ideas on how to fix this?

Tested using: python run_tests.py test/test_dates.py
History
Date User Action Args
2016-06-18 04:14:20rouiljsetstatus: new -> pending
messages: + msg5606
2015-06-28 03:52:00rouiljsetnosy: + rouilj
messages: + msg5331
2015-06-18 11:31:28antmailcreate