Skip to content

Commit 2de6855

Browse files
committed
Fixed a time arithmetics issue in meeting cutoff date methods
- Legacy-Id: 13966
1 parent 8e942f4 commit 2de6855

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

ietf/meeting/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from ietf.person.models import Person
2626
from ietf.utils.storage import NoLocationMigrationFileSystemStorage
2727
from ietf.utils.text import xslugify
28+
from ietf.utils.timezone import date2datetime
2829

2930
countries = pytz.country_names.items()
3031
countries.sort(lambda x,y: cmp(x[1], y[1]))
@@ -116,7 +117,7 @@ def get_00_cutoff(self):
116117
cutoff_date = importantdate.date
117118
else:
118119
cutoff_date = start_date + datetime.timedelta(days=ImportantDateName.objects.get(slug='idcutoff').default_offset_days)
119-
cutoff_time = cutoff_date + self.idsubmit_cutoff_time_utc
120+
cutoff_time = date2datetime(cutoff_date) + self.idsubmit_cutoff_time_utc
120121
return cutoff_time
121122

122123
def get_01_cutoff(self):
@@ -128,7 +129,7 @@ def get_01_cutoff(self):
128129
cutoff_date = importantdate.date
129130
else:
130131
cutoff_date = start_date + datetime.timedelta(days=ImportantDateName.objects.get(slug='idcutoff').default_offset_days)
131-
cutoff_time = cutoff_date + self.idsubmit_cutoff_time_utc
132+
cutoff_time = date2datetime(cutoff_date) + self.idsubmit_cutoff_time_utc
132133
return cutoff_time
133134

134135
def get_reopen_time(self):

ietf/utils/timezone.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ def email_time_to_local_timezone(date_string):
3434

3535
return utc_to_local_timezone(d)
3636

37-
37+
def date2datetime(date, tz=pytz.utc):
38+
return datetime.datetime(*(date.timetuple()[:6]), tzinfo=tz)
39+

0 commit comments

Comments
 (0)