Ticket #16924: patch.diff

File patch.diff, 1.0 KB (added by Drew Roos, 13 years ago)

patch to fix bug

  • django/utils/dateformat.py

     
    1414import re
    1515import time
    1616import calendar
     17import math
    1718from django.utils.dates import MONTHS, MONTHS_3, MONTHS_ALT, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR
    1819from django.utils.tzinfo import LocalTimezone
    1920from django.utils.translation import ugettext as _
     
    182183        return MONTHS_AP[self.data.month]
    183184
    184185    def O(self):
    185         "Difference to Greenwich time in hours; e.g. '+0200'"
     186        "Difference to Greenwich time in hours; e.g. '+0200', '-0330'"
    186187        seconds = self.Z()
    187         return u"%+03d%02d" % (seconds // 3600, (seconds // 60) % 60)
     188        hour = math.copysign(abs(seconds) // 3600, seconds)
     189        minute = (abs(seconds) // 60) % 60
     190        return u"%+03d%02d" % (hour, minute)
    188191
    189192    def r(self):
    190193        "RFC 2822 formatted date; e.g. 'Thu, 21 Dec 2000 16:01:07 +0200'"
Back to Top