Opened 3 years ago

Closed 3 years ago

#31623 closed New feature (fixed)

timesince 'depth' parameter

Reported by: Toby Such Owned by: Tim Park
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 (9)

comment:1 Changed 3 years ago by Toby Such

Owner: changed from nobody to Toby Such
Status: newassigned

comment:2 Changed 3 years ago by Claude Paroz

Triage Stage: UnreviewedAccepted

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

comment:3 Changed 3 years ago by Toby Such

Description: modified (diff)

comment:4 in reply to:  1 Changed 3 years ago by Tim Park

Replying to Toby Such:

Hey Toby!

I started writing some of the core functionality needed for us to implement a depth feature. I'm happy to either (1) touch base with you before going any further or (2) take over this ticket completely.

Let me know.

comment:5 Changed 3 years ago by Tim Park

Owner: changed from Toby Such to Tim Park

comment:6 Changed 3 years ago by David Smith

Has patch: set

comment:7 Changed 3 years ago by Mariusz Felisiak

Patch needs improvement: set

comment:8 Changed 3 years ago by Mariusz Felisiak

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

Refactoring (if necessary) can be done in a separate PR/ticket.

comment:9 Changed 3 years ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 8fa9a6d:

Fixed #31623 -- Allowed specifying number of adjacent time units in timesince()/timeuntil().

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