We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Setting speaker availibilty to "all day" for the last day of the conference triggers an error message of "Submitted availability is not within the event timeframe."
## Expected Behavior
Setting the availibilty to "All Day" should be possible for all days of the conference, even if it ends at some point during this day.

## Current Behavior
Setting the availibility to "All Day" on all days of the conference (in our case monday to sunday) triggers an error message of "Submitted availability is not within the event timeframe."


## Steps to Reproduce

1. Set the conference date to start at 2018-10-22 and end at 2018-10-28
2. Edit a speaker
3. Set the availability to all day for all conference days
4. On the bottom of the page, you the the error message "Submitted availability is not within the event timeframe."

if needed, we can provide a speaker account on the instance for testing.

## Your Environment
* Version used: 0.7.1
* Environment name and version (e.g. Chrome 39, python 3.5): Firefox 61
* Operating System and version (desktop or mobile): Linux Desktop (Debian Unstable)
* Link to your instance, if in production: https://conference.c3w.at


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/pretalx/schedule/forms.py`
Content:
```
1 import datetime
2 import json
3 
4 import django.forms as forms
5 import pytz
6 from django.db import transaction
7 from django.utils.dateparse import parse_datetime
8 from django.utils.translation import ugettext_lazy as _
9 from i18nfield.forms import I18nModelForm
10 
11 from pretalx.common.mixins.forms import ReadOnlyFlag
12 from pretalx.schedule.models import Availability, Room
13 
14 
15 class AvailabilitiesFormMixin(forms.Form):
16     availabilities = forms.CharField(
17         label=_('Availability'),
18         help_text=_('Please click and drag to mark the availability during the conference.'),
19         widget=forms.TextInput(attrs={'class': 'availabilities-editor-data'}),
20         required=False,
21     )
22 
23     def _serialize(self, event, instance):
24         if instance:
25             availabilities = [
26                 avail.serialize()
27                 for avail in instance.availabilities.all()
28             ]
29         else:
30             availabilities = []
31 
32         return json.dumps({
33             'availabilities': availabilities,
34             'event': {
35                 'timezone': event.timezone,
36                 'date_from': str(event.date_from),
37                 'date_to': str(event.date_to),
38             }
39         })
40 
41     def __init__(self, *args, event=None, **kwargs):
42         self.event = event
43         initial = kwargs.pop('initial', dict())
44         initial['availabilities'] = self._serialize(self.event, kwargs['instance'])
45         kwargs['initial'] = initial
46         super().__init__(*args, **kwargs)
47 
48     def _parse_availabilities_json(self, jsonavailabilities):
49         try:
50             rawdata = json.loads(jsonavailabilities)
51         except ValueError:
52             raise forms.ValidationError("Submitted availabilities are not valid json.")
53 
54         try:
55             assert isinstance(rawdata, dict)
56             availabilities = rawdata['availabilities']
57             assert isinstance(availabilities, list)
58             return availabilities
59         except (ValueError, AssertionError, LookupError):
60             raise forms.ValidationError("Submitted json does not comply with format.")
61 
62     def _parse_datetime(self, strdate):
63         tz = pytz.timezone(self.event.timezone)
64 
65         obj = parse_datetime(strdate)
66         assert obj
67         if obj.tzinfo is None:
68             obj = tz.localize(obj)
69 
70         return obj
71 
72     def _validate_availability(self, rawavail):
73         try:
74             assert isinstance(rawavail, dict)
75             rawavail.pop('id', None)
76             rawavail.pop('allDay', None)
77             assert len(rawavail) == 2
78             assert 'start' in rawavail
79             assert 'end' in rawavail
80         except AssertionError:
81             raise forms.ValidationError("Submitted availability does not comply with format.")
82 
83         try:
84             rawavail['start'] = self._parse_datetime(rawavail['start'])
85             rawavail['end'] = self._parse_datetime(rawavail['end'])
86         except (AssertionError, TypeError, ValueError):
87             raise forms.ValidationError("Submitted availability contains an invalid date.")
88 
89         tz = pytz.timezone(self.event.timezone)
90 
91         try:
92             timeframe_start = tz.localize(datetime.datetime.combine(self.event.date_from, datetime.time()))
93             assert rawavail['start'] >= timeframe_start
94             timeframe_end = tz.localize(datetime.datetime.combine(self.event.date_to, datetime.time()))
95             timeframe_end += datetime.timedelta(days=1)
96             assert rawavail['end'] <= timeframe_end
97         except AssertionError:
98             raise forms.ValidationError("Submitted availability is not within the event timeframe.")
99 
100     def clean_availabilities(self):
101         if self.cleaned_data['availabilities'] == '':
102             return None
103 
104         rawavailabilities = self._parse_availabilities_json(self.cleaned_data['availabilities'])
105         availabilities = []
106 
107         for rawavail in rawavailabilities:
108             self._validate_availability(rawavail)
109             availabilities.append(Availability(event_id=self.event.id, **rawavail))
110 
111         return availabilities
112 
113     def _set_foreignkeys(self, instance, availabilities):
114         """
115         Set the reference to `instance` in each given availability.
116 
117         For example, set the availabilitiy.room_id to instance.id, in case instance of type Room.
118         """
119         reference_name = instance.availabilities.field.name + '_id'
120 
121         for avail in availabilities:
122             setattr(avail, reference_name, instance.id)
123 
124     def _replace_availabilities(self, instance, availabilities):
125         with transaction.atomic():
126             # TODO: do not recreate objects unnecessarily, give the client the IDs, so we can track modifications and leave unchanged objects alone
127             instance.availabilities.all().delete()
128             Availability.objects.bulk_create(availabilities)
129 
130     def save(self, *args, **kwargs):
131         instance = super().save(*args, **kwargs)
132         availabilities = self.cleaned_data['availabilities']
133 
134         if availabilities is not None:
135             self._set_foreignkeys(instance, availabilities)
136             self._replace_availabilities(instance, availabilities)
137 
138         return instance
139 
140 
141 class RoomForm(AvailabilitiesFormMixin, ReadOnlyFlag, I18nModelForm):
142 
143     def __init__(self, *args, **kwargs):
144         super().__init__(*args, **kwargs)
145         self.fields['name'].widget.attrs['placeholder'] = _('Room I')
146         self.fields['description'].widget.attrs['placeholder'] = _('Description, e.g.: Our main meeting place, Room I, enter from the right.')
147         self.fields['speaker_info'].widget.attrs['placeholder'] = _('Information for speakers, e.g.: Projector has only HDMI input.')
148         self.fields['capacity'].widget.attrs['placeholder'] = '300'
149 
150     class Meta:
151         model = Room
152         fields = ['name', 'description', 'speaker_info', 'capacity', 'position']
153
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/pretalx/schedule/forms.py b/src/pretalx/schedule/forms.py
--- a/src/pretalx/schedule/forms.py
+++ b/src/pretalx/schedule/forms.py
@@ -91,8 +91,11 @@
         try:
             timeframe_start = tz.localize(datetime.datetime.combine(self.event.date_from, datetime.time()))
             assert rawavail['start'] >= timeframe_start
-            timeframe_end = tz.localize(datetime.datetime.combine(self.event.date_to, datetime.time()))
-            timeframe_end += datetime.timedelta(days=1)
+
+            # add 1 day, not 24 hours, https://stackoverflow.com/a/25427822/2486196
+            timeframe_end = datetime.datetime.combine(self.event.date_to, datetime.time())
+            timeframe_end = timeframe_end + datetime.timedelta(days=1)
+            timeframe_end = tz.localize(timeframe_end, is_dst=None)
             assert rawavail['end'] <= timeframe_end
         except AssertionError:
             raise forms.ValidationError("Submitted availability is not within the event timeframe.")

{"golden_diff": "diff --git a/src/pretalx/schedule/forms.py b/src/pretalx/schedule/forms.py\n--- a/src/pretalx/schedule/forms.py\n+++ b/src/pretalx/schedule/forms.py\n@@ -91,8 +91,11 @@\n         try:\n             timeframe_start = tz.localize(datetime.datetime.combine(self.event.date_from, datetime.time()))\n             assert rawavail['start'] >= timeframe_start\n-            timeframe_end = tz.localize(datetime.datetime.combine(self.event.date_to, datetime.time()))\n-            timeframe_end += datetime.timedelta(days=1)\n+\n+            # add 1 day, not 24 hours, https://stackoverflow.com/a/25427822/2486196\n+            timeframe_end = datetime.datetime.combine(self.event.date_to, datetime.time())\n+            timeframe_end = timeframe_end + datetime.timedelta(days=1)\n+            timeframe_end = tz.localize(timeframe_end, is_dst=None)\n             assert rawavail['end'] <= timeframe_end\n         except AssertionError:\n             raise forms.ValidationError(\"Submitted availability is not within the event timeframe.\")\n", "issue": "Setting speaker availibilty to \"all day\" for the last day of the conference triggers an error message of \"Submitted availability is not within the event timeframe.\"\n## Expected Behavior\r\nSetting the availibilty to \"All Day\" should be possible for all days of the conference, even if it ends at some point during this day.\r\n\r\n## Current Behavior\r\nSetting the availibility to \"All Day\" on all days of the conference (in our case monday to sunday) triggers an error message of \"Submitted availability is not within the event timeframe.\"\r\n\r\n\r\n## Steps to Reproduce\r\n\r\n1. Set the conference date to start at 2018-10-22 and end at 2018-10-28\r\n2. Edit a speaker\r\n3. Set the availability to all day for all conference days\r\n4. On the bottom of the page, you the the error message \"Submitted availability is not within the event timeframe.\"\r\n\r\nif needed, we can provide a speaker account on the instance for testing.\r\n\r\n## Your Environment\r\n* Version used: 0.7.1\r\n* Environment name and version (e.g. Chrome 39, python 3.5): Firefox 61\r\n* Operating System and version (desktop or mobile): Linux Desktop (Debian Unstable)\r\n* Link to your instance, if in production: https://conference.c3w.at\r\n\n", "before_files": [{"content": "import datetime\nimport json\n\nimport django.forms as forms\nimport pytz\nfrom django.db import transaction\nfrom django.utils.dateparse import parse_datetime\nfrom django.utils.translation import ugettext_lazy as _\nfrom i18nfield.forms import I18nModelForm\n\nfrom pretalx.common.mixins.forms import ReadOnlyFlag\nfrom pretalx.schedule.models import Availability, Room\n\n\nclass AvailabilitiesFormMixin(forms.Form):\n    availabilities = forms.CharField(\n        label=_('Availability'),\n        help_text=_('Please click and drag to mark the availability during the conference.'),\n        widget=forms.TextInput(attrs={'class': 'availabilities-editor-data'}),\n        required=False,\n    )\n\n    def _serialize(self, event, instance):\n        if instance:\n            availabilities = [\n                avail.serialize()\n                for avail in instance.availabilities.all()\n            ]\n        else:\n            availabilities = []\n\n        return json.dumps({\n            'availabilities': availabilities,\n            'event': {\n                'timezone': event.timezone,\n                'date_from': str(event.date_from),\n                'date_to': str(event.date_to),\n            }\n        })\n\n    def __init__(self, *args, event=None, **kwargs):\n        self.event = event\n        initial = kwargs.pop('initial', dict())\n        initial['availabilities'] = self._serialize(self.event, kwargs['instance'])\n        kwargs['initial'] = initial\n        super().__init__(*args, **kwargs)\n\n    def _parse_availabilities_json(self, jsonavailabilities):\n        try:\n            rawdata = json.loads(jsonavailabilities)\n        except ValueError:\n            raise forms.ValidationError(\"Submitted availabilities are not valid json.\")\n\n        try:\n            assert isinstance(rawdata, dict)\n            availabilities = rawdata['availabilities']\n            assert isinstance(availabilities, list)\n            return availabilities\n        except (ValueError, AssertionError, LookupError):\n            raise forms.ValidationError(\"Submitted json does not comply with format.\")\n\n    def _parse_datetime(self, strdate):\n        tz = pytz.timezone(self.event.timezone)\n\n        obj = parse_datetime(strdate)\n        assert obj\n        if obj.tzinfo is None:\n            obj = tz.localize(obj)\n\n        return obj\n\n    def _validate_availability(self, rawavail):\n        try:\n            assert isinstance(rawavail, dict)\n            rawavail.pop('id', None)\n            rawavail.pop('allDay', None)\n            assert len(rawavail) == 2\n            assert 'start' in rawavail\n            assert 'end' in rawavail\n        except AssertionError:\n            raise forms.ValidationError(\"Submitted availability does not comply with format.\")\n\n        try:\n            rawavail['start'] = self._parse_datetime(rawavail['start'])\n            rawavail['end'] = self._parse_datetime(rawavail['end'])\n        except (AssertionError, TypeError, ValueError):\n            raise forms.ValidationError(\"Submitted availability contains an invalid date.\")\n\n        tz = pytz.timezone(self.event.timezone)\n\n        try:\n            timeframe_start = tz.localize(datetime.datetime.combine(self.event.date_from, datetime.time()))\n            assert rawavail['start'] >= timeframe_start\n            timeframe_end = tz.localize(datetime.datetime.combine(self.event.date_to, datetime.time()))\n            timeframe_end += datetime.timedelta(days=1)\n            assert rawavail['end'] <= timeframe_end\n        except AssertionError:\n            raise forms.ValidationError(\"Submitted availability is not within the event timeframe.\")\n\n    def clean_availabilities(self):\n        if self.cleaned_data['availabilities'] == '':\n            return None\n\n        rawavailabilities = self._parse_availabilities_json(self.cleaned_data['availabilities'])\n        availabilities = []\n\n        for rawavail in rawavailabilities:\n            self._validate_availability(rawavail)\n            availabilities.append(Availability(event_id=self.event.id, **rawavail))\n\n        return availabilities\n\n    def _set_foreignkeys(self, instance, availabilities):\n        \"\"\"\n        Set the reference to `instance` in each given availability.\n\n        For example, set the availabilitiy.room_id to instance.id, in case instance of type Room.\n        \"\"\"\n        reference_name = instance.availabilities.field.name + '_id'\n\n        for avail in availabilities:\n            setattr(avail, reference_name, instance.id)\n\n    def _replace_availabilities(self, instance, availabilities):\n        with transaction.atomic():\n            # TODO: do not recreate objects unnecessarily, give the client the IDs, so we can track modifications and leave unchanged objects alone\n            instance.availabilities.all().delete()\n            Availability.objects.bulk_create(availabilities)\n\n    def save(self, *args, **kwargs):\n        instance = super().save(*args, **kwargs)\n        availabilities = self.cleaned_data['availabilities']\n\n        if availabilities is not None:\n            self._set_foreignkeys(instance, availabilities)\n            self._replace_availabilities(instance, availabilities)\n\n        return instance\n\n\nclass RoomForm(AvailabilitiesFormMixin, ReadOnlyFlag, I18nModelForm):\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.fields['name'].widget.attrs['placeholder'] = _('Room I')\n        self.fields['description'].widget.attrs['placeholder'] = _('Description, e.g.: Our main meeting place, Room I, enter from the right.')\n        self.fields['speaker_info'].widget.attrs['placeholder'] = _('Information for speakers, e.g.: Projector has only HDMI input.')\n        self.fields['capacity'].widget.attrs['placeholder'] = '300'\n\n    class Meta:\n        model = Room\n        fields = ['name', 'description', 'speaker_info', 'capacity', 'position']\n", "path": "src/pretalx/schedule/forms.py"}], "after_files": [{"content": "import datetime\nimport json\n\nimport django.forms as forms\nimport pytz\nfrom django.db import transaction\nfrom django.utils.dateparse import parse_datetime\nfrom django.utils.translation import ugettext_lazy as _\nfrom i18nfield.forms import I18nModelForm\n\nfrom pretalx.common.mixins.forms import ReadOnlyFlag\nfrom pretalx.schedule.models import Availability, Room\n\n\nclass AvailabilitiesFormMixin(forms.Form):\n    availabilities = forms.CharField(\n        label=_('Availability'),\n        help_text=_('Please click and drag to mark the availability during the conference.'),\n        widget=forms.TextInput(attrs={'class': 'availabilities-editor-data'}),\n        required=False,\n    )\n\n    def _serialize(self, event, instance):\n        if instance:\n            availabilities = [\n                avail.serialize()\n                for avail in instance.availabilities.all()\n            ]\n        else:\n            availabilities = []\n\n        return json.dumps({\n            'availabilities': availabilities,\n            'event': {\n                'timezone': event.timezone,\n                'date_from': str(event.date_from),\n                'date_to': str(event.date_to),\n            }\n        })\n\n    def __init__(self, *args, event=None, **kwargs):\n        self.event = event\n        initial = kwargs.pop('initial', dict())\n        initial['availabilities'] = self._serialize(self.event, kwargs['instance'])\n        kwargs['initial'] = initial\n        super().__init__(*args, **kwargs)\n\n    def _parse_availabilities_json(self, jsonavailabilities):\n        try:\n            rawdata = json.loads(jsonavailabilities)\n        except ValueError:\n            raise forms.ValidationError(\"Submitted availabilities are not valid json.\")\n\n        try:\n            assert isinstance(rawdata, dict)\n            availabilities = rawdata['availabilities']\n            assert isinstance(availabilities, list)\n            return availabilities\n        except (ValueError, AssertionError, LookupError):\n            raise forms.ValidationError(\"Submitted json does not comply with format.\")\n\n    def _parse_datetime(self, strdate):\n        tz = pytz.timezone(self.event.timezone)\n\n        obj = parse_datetime(strdate)\n        assert obj\n        if obj.tzinfo is None:\n            obj = tz.localize(obj)\n\n        return obj\n\n    def _validate_availability(self, rawavail):\n        try:\n            assert isinstance(rawavail, dict)\n            rawavail.pop('id', None)\n            rawavail.pop('allDay', None)\n            assert len(rawavail) == 2\n            assert 'start' in rawavail\n            assert 'end' in rawavail\n        except AssertionError:\n            raise forms.ValidationError(\"Submitted availability does not comply with format.\")\n\n        try:\n            rawavail['start'] = self._parse_datetime(rawavail['start'])\n            rawavail['end'] = self._parse_datetime(rawavail['end'])\n        except (AssertionError, TypeError, ValueError):\n            raise forms.ValidationError(\"Submitted availability contains an invalid date.\")\n\n        tz = pytz.timezone(self.event.timezone)\n\n        try:\n            timeframe_start = tz.localize(datetime.datetime.combine(self.event.date_from, datetime.time()))\n            assert rawavail['start'] >= timeframe_start\n\n            # add 1 day, not 24 hours, https://stackoverflow.com/a/25427822/2486196\n            timeframe_end = datetime.datetime.combine(self.event.date_to, datetime.time())\n            timeframe_end = timeframe_end + datetime.timedelta(days=1)\n            timeframe_end = tz.localize(timeframe_end, is_dst=None)\n            assert rawavail['end'] <= timeframe_end\n        except AssertionError:\n            raise forms.ValidationError(\"Submitted availability is not within the event timeframe.\")\n\n    def clean_availabilities(self):\n        if self.cleaned_data['availabilities'] == '':\n            return None\n\n        rawavailabilities = self._parse_availabilities_json(self.cleaned_data['availabilities'])\n        availabilities = []\n\n        for rawavail in rawavailabilities:\n            self._validate_availability(rawavail)\n            availabilities.append(Availability(event_id=self.event.id, **rawavail))\n\n        return availabilities\n\n    def _set_foreignkeys(self, instance, availabilities):\n        \"\"\"\n        Set the reference to `instance` in each given availability.\n\n        For example, set the availabilitiy.room_id to instance.id, in case instance of type Room.\n        \"\"\"\n        reference_name = instance.availabilities.field.name + '_id'\n\n        for avail in availabilities:\n            setattr(avail, reference_name, instance.id)\n\n    def _replace_availabilities(self, instance, availabilities):\n        with transaction.atomic():\n            # TODO: do not recreate objects unnecessarily, give the client the IDs, so we can track modifications and leave unchanged objects alone\n            instance.availabilities.all().delete()\n            Availability.objects.bulk_create(availabilities)\n\n    def save(self, *args, **kwargs):\n        instance = super().save(*args, **kwargs)\n        availabilities = self.cleaned_data['availabilities']\n\n        if availabilities is not None:\n            self._set_foreignkeys(instance, availabilities)\n            self._replace_availabilities(instance, availabilities)\n\n        return instance\n\n\nclass RoomForm(AvailabilitiesFormMixin, ReadOnlyFlag, I18nModelForm):\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.fields['name'].widget.attrs['placeholder'] = _('Room I')\n        self.fields['description'].widget.attrs['placeholder'] = _('Description, e.g.: Our main meeting place, Room I, enter from the right.')\n        self.fields['speaker_info'].widget.attrs['placeholder'] = _('Information for speakers, e.g.: Projector has only HDMI input.')\n        self.fields['capacity'].widget.attrs['placeholder'] = '300'\n\n    class Meta:\n        model = Room\n        fields = ['name', 'description', 'speaker_info', 'capacity', 'position']\n", "path": "src/pretalx/schedule/forms.py"}]}