Opened 5 years ago

Last modified 4 years ago

#31623 closed New feature

timesince 'depth' parameter — at Version 3

Reported by: Toby Such Owned by: Toby Such
Component: Utilities Version: dev
Severity: Normal Keywords: timesince
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Toby Such)

Discussed here. The timesince function is a bit limiting as it is right now. A depth parameter should be added to configure how many values are shown. The depth parameter should be defaulted to 2 as this is how the current implementation behaves. The existing rule of values having to be adjacent to one another should still remain.

The logic for calculating the time since, before formatting should also be pulled out of the function and placed in its own so that custom implementations can be created.

For example:
With a depth of one it should always display as "1 week" or "3 years" etc.
With a depth of two: "1 week, 3 days" or "3 years, 7 months"
With a depth of three: "1 week, 3 days, 5 hours" or "3 years, 7 months, 2 weeks"

Change History (3)

comment:1 by Toby Such, 5 years ago

Owner: changed from nobody to Toby Such
Status: newassigned

comment:2 by Claude Paroz, 5 years ago

Triage Stage: UnreviewedAccepted

As discussed on the ML, the most important thing is to make it easily customizable.

comment:3 by Toby Such, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top