2

This question was asked suppress django naive datetime warnings

But the answer is to stop supporting Time zones. My app has other functionality that will indeed need to support timezones, but I am working on a feature currently that requires raw support for relative time (ie user was online in the past x minutes)

If I switch to django.utils.timezone will that throw off relative time? if so, is there another way to squelch this warning?

Vincent Buscarello
  • 395
  • 2
  • 7
  • 19
  • You can calculate time intervals with timezones too. It's actually better, because the internal will never be wrong due to timezone changes. – kichik Nov 13 '17 at 18:30
  • So you are proposing just using `django.utils.timezone` for all internals --- this timezone will not change on the server side based on *any* user correct? docs seem to imply its just for templates/forms but I want to be extremely clear that relative comparisons will NOT be affected by the users tz – Vincent Buscarello Nov 13 '17 at 19:00
  • 2
    Non-naive datetime objects just means they have a timezone attached. That means that no matter what timezone you have set anywhere, you'd always know the original time and be able to convert it to that timezone. So yes, you are correct and the user's timezone will not affect it. – kichik Nov 13 '17 at 19:05

0 Answers0