Code

Ticket #10022: date_based_one_digit_month_confusion.patch

File date_based_one_digit_month_confusion.patch, 1.1 KB (added by Ryszard Szopa <ryszard.szopa@…>, 5 years ago)

patch solving the problem

  • django/views/generic/date_based.py

     
    237237    """ 
    238238    if extra_context is None: extra_context = {} 
    239239    try: 
    240         date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3]) 
     240        date = datetime.date(time.strptime(year, '%Y')[0], 
     241                             time.strptime(month, month_format)[1], 
     242                             time.strptime(day, month_format)[2]) 
    241243    except ValueError: 
    242244        raise Http404 
    243245 
     
    307309    """ 
    308310    if extra_context is None: extra_context = {} 
    309311    try: 
    310         date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3]) 
     312        date = datetime.date(time.strptime(year, '%Y')[0], 
     313                             time.strptime(month, month_format)[1], 
     314                             time.strptime(day, month_format)[2]) 
    311315    except ValueError: 
    312316        raise Http404 
    313317