Opened 4 years ago

Last modified 4 years ago

#31623 closed New feature

timesince 'depth' parameter — at Initial Version

Reported by: Toby Such Owned by: nobody
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

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 (0)

Note: See TracTickets for help on using tickets.
Back to Top