can't compare offset-naive and offset-aware

if (item.from_datetime.replace(tzinfo=None) >= datetime.datetime.now()):


Django默認支持多時區;web


dt = datetime.datetime(2015, 4, 9, 11, 2, 52,  tzinfo=<LocalTimezone>) : offset-awarespa

  now  =   datetime.datetime.now() : offset-naive
  dt 
=  dt.replace(tzinfo = None )
相關文章
相關標籤/搜索