[Django] #31623: timesince 'depth' parameter

16 views
Skip to first unread message

Django

unread,
May 23, 2020, 1:49:50 PM5/23/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
---------------------------------------+---------------------------
Reporter: Toby Such | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: master
Severity: Normal | Keywords: timesince
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
---------------------------------------+---------------------------
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"

--
Ticket URL: <https://code.djangoproject.com/ticket/31623>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 23, 2020, 1:50:28 PM5/23/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+--------------------------------------
Reporter: Toby Such | Owner: Toby Such
Type: New feature | Status: assigned
Component: Utilities | Version: master
Severity: Normal | Resolution:

Keywords: timesince | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Toby Such):

* owner: nobody => Toby Such
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:1>

Django

unread,
May 23, 2020, 2:58:16 PM5/23/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+-------------------------------------

Reporter: Toby Such | Owner: Toby Such
Type: New feature | Status: assigned
Component: Utilities | Version: master
Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by Claude Paroz):

* stage: Unreviewed => Accepted


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:2>

Django

unread,
May 24, 2020, 10:19:45 AM5/24/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+-------------------------------------
Reporter: Toby Such | Owner: Toby Such
Type: New feature | Status: assigned
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Description changed by Toby Such:

Old 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"

New description:

Discussed [https://groups.google.com/forum/#!topic/django-developers
/pEaX5X-wpWo 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"

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:3>

Django

unread,
Jul 3, 2020, 3:39:52 AM7/3/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+-------------------------------------
Reporter: Toby Such | Owner: Toby Such
Type: New feature | Status: assigned
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by Tim Park):

Replying to [comment:1 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:4>

Django

unread,
Jul 3, 2020, 7:16:06 PM7/3/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+------------------------------------
Reporter: Toby Such | Owner: Tim Park

Type: New feature | Status: assigned
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Tim Park):

* owner: Toby Such => Tim Park


--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:5>

Django

unread,
Jul 4, 2020, 4:07:50 AM7/4/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+------------------------------------
Reporter: Toby Such | Owner: Tim Park
Type: New feature | Status: assigned
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by David Smith):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/13145 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:6>

Django

unread,
Jul 8, 2020, 1:53:16 AM7/8/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+------------------------------------
Reporter: Toby Such | Owner: Tim Park
Type: New feature | Status: assigned
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by felixxm):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:7>

Django

unread,
Jul 16, 2020, 2:03:36 AM7/16/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+---------------------------------------------

Reporter: Toby Such | Owner: Tim Park
Type: New feature | Status: assigned
Component: Utilities | Version: master
Severity: Normal | Resolution:
Keywords: timesince | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+---------------------------------------------
Changes (by felixxm):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:8>

Django

unread,
Jul 16, 2020, 4:42:16 AM7/16/20
to django-...@googlegroups.com
#31623: timesince 'depth' parameter
-----------------------------+---------------------------------------------
Reporter: Toby Such | Owner: Tim Park
Type: New feature | Status: closed
Component: Utilities | Version: master
Severity: Normal | Resolution: fixed

Keywords: timesince | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+---------------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"8fa9a6d29efe2622872b4788190ea7c1bcb92019" 8fa9a6d]:
{{{
#!CommitTicketReference repository=""
revision="8fa9a6d29efe2622872b4788190ea7c1bcb92019"
Fixed #31623 -- Allowed specifying number of adjacent time units in
timesince()/timeuntil().
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:9>

Reply all
Reply to author
Forward
0 new messages