Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
6128c173
Kaydet (Commit)
6128c173
authored
Ock 02, 2017
tarafından
vinay karanam
Kaydeden (comit)
Tim Graham
Ock 02, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #27637 -- Fixed timesince, timeuntil on New Year's Eve in a leap year.
üst
26c9f529
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
timesince.py
django/utils/timesince.py
+5
-2
1.10.5.txt
docs/releases/1.10.5.txt
+1
-1
1.9.13.txt
docs/releases/1.9.13.txt
+1
-1
test_timesince.py
tests/utils_tests/test_timesince.py
+6
-0
No files found.
django/utils/timesince.py
Dosyayı görüntüle @
6128c173
...
...
@@ -46,8 +46,11 @@ def timesince(d, now=None, reversed=False):
# Deal with leapyears by subtracing the number of leapdays
leapdays
=
calendar
.
leapdays
(
d
.
year
,
now
.
year
)
if
leapdays
!=
0
and
calendar
.
isleap
(
d
.
year
):
leapdays
-=
1
if
leapdays
!=
0
:
if
calendar
.
isleap
(
d
.
year
):
leapdays
-=
1
elif
calendar
.
isleap
(
now
.
year
):
leapdays
+=
1
delta
-=
datetime
.
timedelta
(
leapdays
)
# ignore microseconds
...
...
docs/releases/1.10.5.txt
Dosyayı görüntüle @
6128c173
...
...
@@ -16,4 +16,4 @@ Bugfixes
(:ticket:`27418`).
* Fixed a regression in the ``timesince`` and ``timeuntil`` filters that caused
incorrect results for dates in a leap year.
incorrect results for dates in a leap year
(:ticket:`27637`)
.
docs/releases/1.9.13.txt
Dosyayı görüntüle @
6128c173
...
...
@@ -10,4 +10,4 @@ Bugfixes
========
* Fixed a regression in the ``timesince`` and ``timeuntil`` filters that caused
incorrect results for dates in a leap year.
incorrect results for dates in a leap year
(:ticket:`27637`)
.
tests/utils_tests/test_timesince.py
Dosyayı görüntüle @
6128c173
...
...
@@ -110,6 +110,12 @@ class TimesinceTests(unittest.TestCase):
self
.
assertEqual
(
timeuntil
(
start_date
+
self
.
oneweek
,
start_date
),
'1
\xa0
week'
)
self
.
assertEqual
(
timesince
(
start_date
,
start_date
+
self
.
oneweek
),
'1
\xa0
week'
)
def
test_leap_year_new_years_eve
(
self
):
t
=
datetime
.
date
(
2016
,
12
,
31
)
now
=
datetime
.
datetime
(
2016
,
12
,
31
,
18
,
0
,
0
)
self
.
assertEqual
(
timesince
(
t
+
self
.
oneday
,
now
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timeuntil
(
t
-
self
.
oneday
,
now
),
'0
\xa0
minutes'
)
def
test_naive_datetime_with_tzinfo_attribute
(
self
):
class
naive
(
datetime
.
tzinfo
):
def
utcoffset
(
self
,
dt
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment