#24955: Allow BC and > 10000 years dates in Django ORM & forms -------------------------------------+------------------------------------- Reporter: BertrandBordage | Owner: nobody Type: New feature | Status: new Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by BertrandBordage): Dependencies are not a problem, it’s their job to follow what’s new in each major CPython version, otherwise that would mean that nothing can be changed in Python. Recently, CPython changed the boolean evaluation of {{{time(0, 0, 0)}}} (see [https://bugs.python.org/issue13936 issue 13936]), and it didn’t take years to make that. Similarly, in Django we don’t stick to bad choices just because a hundred libraries rely on it. About the year 0, that’s right, it’s mainly a matter of representation. The real problem is to decide whether we return 0 or -1 for year -1. Returning 0 is more logic if we want to do arithmetic with years, but it’s more misleading. The best solution IMO is to return -1 for year -1 and 1 for year 1. This mean arithmetic with extracted years will be false, but not with dates. Since few people will use BC dates, and it’ll be more likely for historic purposes, and we usually don’t have precise dates BC (at least because of the mess of the multiple calendars that can lead to several years of error). So if someone makes calculus on extracted years (which isn’t recommended), it’ll be false, but this is an acceptable approximation. For info, PostgreSQL returns -1 when we extract the year of {{{0001-01-01 BC}}}. The solution of using Astropy as answered in the stackoverflow issue is a total overkill. -- Ticket URL: <https://code.djangoproject.com/ticket/24955#comment:7> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/073.e1acc2f9964a55a1bf25b42c3b815e09%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.