Fixed some #timezoneIssues

This commit is contained in:
David Taylor
2015-06-29 21:07:10 +01:00
parent 2d1369dfe9
commit f190b9192b
3 changed files with 2 additions and 6 deletions

View File

@@ -382,7 +382,7 @@ class Event(models.Model, RevisionMixin):
startDateTime = tz.localize(startDateTime) startDateTime = tz.localize(startDateTime)
datetime_list.append(startDateTime) # then add it to the list datetime_list.append(startDateTime) # then add it to the list
earliest = min(datetime_list) #find the earliest datetime in the list earliest = min(datetime_list).astimezone(tz) #find the earliest datetime in the list
# if we faked it & it's the earliest, better own up # if we faked it & it's the earliest, better own up
if startTimeFaked and earliest==startDateTime: if startTimeFaked and earliest==startDateTime:
@@ -393,7 +393,7 @@ class Event(models.Model, RevisionMixin):
@property @property
def latest_time(self): def latest_time(self):
"""Returns the end of the event - this function could return either a tzaware datetime, or a naiive date object""" """Returns the end of the event - this function could return either a tzaware datetime, or a naiive date object"""
tz = pytz.timezone(settings.TIME_ZONE)
endDate = self.end_date endDate = self.end_date
if endDate is None: if endDate is None:
endDate = self.start_date endDate = self.start_date

View File

@@ -17,7 +17,6 @@
$(document).ready(function() { $(document).ready(function() {
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
//defaultDate: '2015-02-12',
editable: false, editable: false,
eventLimit: true, // allow "more" link when too many events eventLimit: true, // allow "more" link when too many events
firstDay: 1, firstDay: 1,

View File

@@ -302,9 +302,6 @@ class SecureAPIRequest(generic.View):
start_datetime = datetime.datetime.strptime( start, "%Y-%m-%dT%H:%M:%S" ) start_datetime = datetime.datetime.strptime( start, "%Y-%m-%dT%H:%M:%S" )
end_datetime = datetime.datetime.strptime( end, "%Y-%m-%dT%H:%M:%S" ) end_datetime = datetime.datetime.strptime( end, "%Y-%m-%dT%H:%M:%S" )
tz = pytz.timezone(settings.TIME_ZONE)
start_datetime = tz.localize(start_datetime)
objects = self.models[model].objects.events_in_bounds(start_datetime,end_datetime) objects = self.models[model].objects.events_in_bounds(start_datetime,end_datetime)
results = [] results = []