Ticket #9065: 9065-combined.diff

File 9065-combined.diff, 2.4 KB (added by mboersma, 6 years ago)

Combined diff file, updated against trunk [10088]

  • django/utils/timesince.py

     
    2929    if d.__class__ is not datetime.datetime:
    3030        d = datetime.datetime(d.year, d.month, d.day)
    3131
     32    if now and now.__class__ is not datetime.datetime:
     33        now = datetime.datetime(now.year, now.month, now.day)
     34
    3235    if not now:
    3336        if d.tzinfo:
    3437            now = datetime.datetime.now(LocalTimezone(d))
  • tests/regressiontests/templates/filters.py

     
    77consistent.
    88"""
    99
    10 from datetime import datetime, timedelta
     10from datetime import date, datetime, timedelta
    1111
    1212from django.utils.tzinfo import LocalTimezone, FixedOffset
    1313from django.utils.safestring import mark_safe
     
    2828    now = datetime.now()
    2929    now_tz = datetime.now(LocalTimezone(now))
    3030    now_tz_i = datetime.now(FixedOffset((3 * 60) + 15)) # imaginary time zone
     31    today = date.today()
     32
    3133    return {
    3234        # Default compare with datetime.now()
    3335        'filter-timesince01' : ('{{ a|timesince }}', {'a': datetime.now() + timedelta(minutes=-1, seconds = -10)}, '1 minute'),
     
    5557        'filter-timesince15' : ('{{ a|timesince:b }}', {'a': now, 'b': now_tz_i}, ''),
    5658        'filter-timesince16' : ('{{ a|timesince:b }}', {'a': now_tz_i, 'b': now}, ''),
    5759
     60        # Regression for #9065
     61        'filter-timesince17' : ('{{ a|timesince:b }}', {'a': today, 'b': today}, '0 minutes'),
     62        'filter-timesince18' : ('{{ a|timesince:b }}', {'a': today, 'b': today + timedelta(hours=24)}, '1 day'),
     63       
    5864        # Default compare with datetime.now()
    5965        'filter-timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now() + timedelta(minutes=2, seconds = 10)}, '2 minutes'),
    6066        'filter-timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1, seconds = 10))}, '1 day'),
     
    290296        'join03': (r'{{ a|join:" & " }}', {'a': ['alpha', 'beta & me']}, 'alpha & beta & me'),
    291297        'join04': (r'{% autoescape off %}{{ a|join:" & " }}{% endautoescape %}', {'a': ['alpha', 'beta & me']}, 'alpha & beta & me'),
    292298    }
    293 
Back to Top