#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 <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.7e754b641b9946568c03ea99a288e5a3%40djangoproject.com.