Hi Carlton,

I understand, thank you.

Uri Rodberg, Speedy Net

אורי
u...@speedy.net


On Tue, Aug 2, 2022 at 10:54 AM Carlton Gibson <carlton.gib...@gmail.com>
wrote:

> Hey Uri.
>
> Historically, taking on extra dependencies isn't something we've done
> lightly.
> The packaging situation is a lot better these days than it was in
> earlier years, but with the concerns about supply chain security I think
> maintaining that position is worthwhile.
> If we were to take on python-dateutil as a required dependency there would
> be folks needing to go through an additional security audit in order to get
> permission to upgrade Django. I wouldn't think two template tags justifies
> that.
>
> So then, it would need to be optional.
> But then it could just live in a third-party package.
> (I don't think we really document it, but one could shadow/override the
> built-in tags with the improved versions if your app was installed, I
> guess...)
>
> Or that would be my initial thought. 🤔
>
> Kind Regards,
>
> Carlton
>
>
> ‪On Tue, 2 Aug 2022 at 03:27, ‫אורי‬‎ <u...@speedy.net> wrote:‬
>
>> Hi,
>>
>> Lately I discovered some inaccuracy bugs in timesince (and timeuntil),
>> and I created a ticket (#33879
>> <https://code.djangoproject.com/ticket/33879>). In short, the problems
>> are when calculating a year minus one week, 2 weeks, one day etc. and also
>> 2 years minus one or 2 days. In all such cases, Django's implementation
>> of timesince is inaccurate, in some cases resulting in "1 year, 12
>> months" (for 2 years minus one or 2 days) or adding a week (for a year
>> minus one or 2 weeks). I read the code of Django's timesince implementation
>> and it's quite long, and I searched and found that python-dateutil already
>> have such methods, which is possible to calculate exactly the number of
>> days between two dates like this:
>>
>>
>>
>>
>>
>>
>>
>>
>> *from dateutil.relativedelta import relativedeltadiff =
>> relativedelta(date2, date1)years = diff.yearsmonths = diff.monthsweeks =
>> diff.days // 7days = diff.days - weeks * 7 # ("**diff.days % 7" will
>> also work here)*
>>
>> This calculates exactly the number of years, months, weeks and days and
>> not an approximation like Django's implementation. And python-dateutil is
>> stable and I think exists even before Django. I recently started using
>> Django's timesince function in my own website, and I like the way it's
>> translated (currently only to English and Hebrew). Do you think it's worth
>> using python-dateutil in the Django implementation of timesince and
>> timeuntil?
>>
>> Of course, I can also implement my own version of timesince which
>> uses python-dateutil and doesn't use Django. But since timesince and
>> timeuntil are built-in tags in Django, I guess many websites are using
>> them. Isn't it better to use a more precise implementation and avoid
>> something like "1 year, 12 months"?
>>
>> Thanks,
>> Uri Rodberg, Speedy Net
>> אורי
>> u...@speedy.net
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CABD5YeEC_o%2BwQVF8pj3Kat57MXfX071LT0rZAq2XipFFCK%3DFBQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-developers/CABD5YeEC_o%2BwQVF8pj3Kat57MXfX071LT0rZAq2XipFFCK%3DFBQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAJwKpyTwuAQvq%2BwB3Pv_HfSBHiZLf2gq3nCPmYGVrvyCY2GfmA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAJwKpyTwuAQvq%2BwB3Pv_HfSBHiZLf2gq3nCPmYGVrvyCY2GfmA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CABD5YeGpeLJW3rggstfm%3DYhumSGymFGm3FGXyX%3DCD4T6uedjHQ%40mail.gmail.com.
  • ... אורי
    • ... Carlton Gibson
      • ... אורי
      • ... אורי
        • ... 'st...@jigsawtech.co.uk' via Django developers (Contributions to Django itself)

Reply via email to