Opened 4 years ago

Closed 4 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 by Toby Such, 4 years ago

Owner: changed from nobody to Toby Such
Status: newassigned

comment:2 by Claude Paroz, 4 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, 4 years ago

Description: modified (diff)

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

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 by Tim Park, 4 years ago

Owner: changed from Toby Such to Tim Park

comment:6 by David Smith, 4 years ago

Has patch: set

comment:7 by Mariusz Felisiak, 4 years ago

Patch needs improvement: set

comment:8 by Mariusz Felisiak, 4 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

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

comment:9 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

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