Opened 4 days ago
Closed 4 days ago
#36820 closed New feature (wontfix)
Date Parsing Modernization
| Reported by: | Varun Kasyap Pentamaraju | Owned by: | Varun Kasyap Pentamaraju |
|---|---|---|---|
| Component: | Utilities | Version: | dev |
| Severity: | Normal | Keywords: | dateparse, timesince |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I have been analyzing django.utils.dateparse and django.utils.timesince. Currently, developers have to write custom logic for many very common use cases.
Maybe we should add built-in support for these common cases:
Please correct me if i am wrong
1) parse_datetime relies on regex and does not support partial dates (for example, providing "2024" returns None instead of a datetime like 2024-01-01 12:00).
2) timesince forces long-form output such as "1 year, 2 months" using hard-coded joins, while modern UIs prefer compact formats like "1y 2mo" or "2w".
3) Support a customizable “Just now” threshold instead of returning "0 minutes" for small time differences.
Change History (2)
comment:1 by , 4 days ago
| Description: | modified (diff) |
|---|
comment:2 by , 4 days ago
| Resolution: | → wontfix |
|---|---|
| Status: | assigned → closed |
First, please don't combine multiple issues in one ticket.
Second, you haven't presented each case in sufficient detail to explain why they are "very common use cases." Do you have examples of projects that implement each proposal?
Generally, new features require some discussion on the Django Forum or at https://github.com/django/new-features.