diff --git a/khal/ui/editor.py b/khal/ui/editor.py
index 4333004..94cadca 100644
--- a/khal/ui/editor.py
+++ b/khal/ui/editor.py
@@ -235,7 +235,7 @@ class StartEndEditor(urwid.WidgetWrap):
             return endval
 
     def _end_date_change(self, date):
-        self._enddt = self.localize_end(dt.datetime.combine(date, self._start_time))
+        self._enddt = self.localize_end(dt.datetime.combine(date, self._end_time))
         self.on_end_date_change(date)
 
     def toggle(self, checkbox, state):
@@ -277,25 +277,23 @@ class StartEndEditor(urwid.WidgetWrap):
             self.widgets.endtime = urwid.Text('')
         elif state is False:
             timewidth = self._timewidth + 1
-            edit = ValidatedEdit(
+            raw_start_time_widget = ValidatedEdit(
                 dateformat=self.conf['locale']['timeformat'],
                 EditWidget=TimeWidget,
                 validate=self._validate_start_time,
                 edit_text=self.startdt.strftime(self.conf['locale']['timeformat']),
             )
-            edit = urwid.Padding(
-                edit, align='left', width=self._timewidth + 1, left=1)
-            self.widgets.starttime = edit
+            self.widgets.starttime = urwid.Padding(
+                raw_start_time_widget, align='left', width=self._timewidth + 1, left=1)
 
-            edit = ValidatedEdit(
+            raw_end_time_widget = ValidatedEdit(
                 dateformat=self.conf['locale']['timeformat'],
                 EditWidget=TimeWidget,
                 validate=self._validate_end_time,
                 edit_text=self.enddt.strftime(self.conf['locale']['timeformat']),
             )
-            edit = urwid.Padding(
-                edit, align='left', width=self._timewidth + 1, left=1)
-            self.widgets.endtime = edit
+            self.widgets.endtime = urwid.Padding(
+                raw_end_time_widget, align='left', width=self._timewidth + 1, left=1)
 
         columns = NPile([
             self.checkallday,

Double issue: invalid time range parsing + warning message display
Two problems are shown in the attached screenshot:
- when entering this event (using only default values, especially the start and end hours 8:00 to 9:00), the time range is not understood by khal
- warning messages are displayed (very shortly, less than 1 sec) in the middle of the screen, and are erased as soon as the screen is being refreshed, which prevents the user to see them

![screenshot_20170608_082535](https://user-images.githubusercontent.com/412628/26914970-5213000a-4c24-11e7-86a0-877a53979524.png)

diff --git a/tests/ui/test_editor.py b/tests/ui/test_editor.py
index 080a00d..27b7fa5 100644
--- a/tests/ui/test_editor.py
+++ b/tests/ui/test_editor.py
@@ -4,12 +4,21 @@ import icalendar
 from khal.ui.editor import RecurrenceEditor, StartEndEditor
 
 from ..utils import BERLIN, LOCALE_BERLIN
+from .canvas_render import CanvasTranslator
 
 CONF = {'locale': LOCALE_BERLIN, 'keybindings': {}, 'view': {'monthdisplay': 'firstday'}}
 
 START = BERLIN.localize(dt.datetime(2015, 4, 26, 22, 23))
 END = BERLIN.localize(dt.datetime(2015, 4, 27, 23, 23))
 
+palette = {
+    'date header focused': 'blue',
+    'date header': 'green',
+    'default': 'black',
+    'editf': 'red',
+    'edit': 'blue',
+}
+
 
 def test_popup(monkeypatch):
     """making sure the popup calendar gets callend with the right inital value
@@ -65,3 +74,60 @@ def test_check_understood_rrule():
     assert not RecurrenceEditor.check_understood_rrule(
         icalendar.vRecur.from_ical('FREQ=MONTHLY;BYDAY=TH;BYSETPOS=3')
     )
+
+
+def test_editor():
+    """test for the issue in #666"""
+    editor = StartEndEditor(
+        BERLIN.localize(dt.datetime(2017, 10, 2, 13)),
+        BERLIN.localize(dt.datetime(2017, 10, 4, 18)),
+        conf=CONF
+    )
+    assert editor.startdt == BERLIN.localize(dt.datetime(2017, 10, 2, 13))
+    assert editor.enddt == BERLIN.localize(dt.datetime(2017, 10, 4, 18))
+    assert editor.changed is False
+    for _ in range(3):
+        editor.keypress((10, ), 'tab')
+    for _ in range(3):
+        editor.keypress((10, ), 'shift tab')
+    assert editor.startdt == BERLIN.localize(dt.datetime(2017, 10, 2, 13))
+    assert editor.enddt == BERLIN.localize(dt.datetime(2017, 10, 4, 18))
+    assert editor.changed is False
+
+
+def test_convert_to_date():
+    """test for the issue in #666"""
+    editor = StartEndEditor(
+        BERLIN.localize(dt.datetime(2017, 10, 2, 13)),
+        BERLIN.localize(dt.datetime(2017, 10, 4, 18)),
+        conf=CONF
+    )
+    canvas = editor.render((50, ), True)
+    assert CanvasTranslator(canvas, palette).transform() == (
+        '[ ] Allday\nFrom: \x1b[31m2.10.2017 \x1b[0m \x1b[34m13:00 \x1b[0m\n'
+        'To:   \x1b[34m04.10.2017\x1b[0m \x1b[34m18:00 \x1b[0m\n'
+    )
+
+    assert editor.startdt == BERLIN.localize(dt.datetime(2017, 10, 2, 13))
+    assert editor.enddt == BERLIN.localize(dt.datetime(2017, 10, 4, 18))
+    assert editor.changed is False
+    assert editor.allday is False
+
+    # set to all day event
+    editor.keypress((10, ), 'shift tab')
+    editor.keypress((10, ), ' ')
+    for _ in range(3):
+        editor.keypress((10, ), 'tab')
+    for _ in range(3):
+        editor.keypress((10, ), 'shift tab')
+
+    canvas = editor.render((50, ), True)
+    assert CanvasTranslator(canvas, palette).transform() == (
+        '[X] Allday\nFrom: \x1b[34m02.10.2017\x1b[0m  \n'
+        'To:   \x1b[34m04.10.2017\x1b[0m  \n'
+    )
+
+    assert editor.changed is True
+    assert editor.allday is True
+    assert editor.startdt == dt.date(2017, 10, 2)
+    assert editor.enddt == dt.date(2017, 10, 4)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov freezegun vdirsyncer
apt-get update apt-get install -y gcc
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
aiohappyeyeballs==2.6.1
aiohttp==3.11.14
aiosignal==1.3.2
aiostream==0.4.5
async-timeout==5.0.1
atomicwrites==1.4.1
attrs==25.3.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
click-log==0.4.0
configobj==5.0.9
coverage==7.8.0
exceptiongroup==1.2.2
freezegun==1.5.1
frozenlist==1.5.0
icalendar==6.1.3
idna==3.10
iniconfig==2.1.0
-e git+https://github.com/pimutils/khal.git@e4fe38059c109c0d6efdec81c98e4e8abe80b2a2#egg=khal
multidict==6.2.0
packaging==24.2
pluggy==1.5.0
propcache==0.3.1
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
pyxdg==0.28
requests==2.32.3
six==1.17.0
tomli==2.2.1
typing_extensions==4.13.0
tzdata==2025.2
tzlocal==5.3.1
urllib3==2.3.0
urwid==2.6.16
vdirsyncer==0.19.3
wcwidth==0.2.13
yarl==1.18.3

name: khal
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - aiohappyeyeballs==2.6.1
      - aiohttp==3.11.14
      - aiosignal==1.3.2
      - aiostream==0.4.5
      - async-timeout==5.0.1
      - atomicwrites==1.4.1
      - attrs==25.3.0
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - click==8.1.8
      - click-log==0.4.0
      - configobj==5.0.9
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - freezegun==1.5.1
      - frozenlist==1.5.0
      - icalendar==6.1.3
      - idna==3.10
      - iniconfig==2.1.0
      - multidict==6.2.0
      - packaging==24.2
      - pluggy==1.5.0
      - propcache==0.3.1
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyxdg==0.28
      - requests==2.32.3
      - six==1.17.0
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - tzdata==2025.2
      - tzlocal==5.3.1
      - urllib3==2.3.0
      - urwid==2.6.16
      - vdirsyncer==0.19.3
      - wcwidth==0.2.13
      - yarl==1.18.3
prefix: /opt/conda/envs/khal

tests/ui/test_editor.py::test_editor
tests/ui/test_editor.py::test_popup
tests/ui/test_editor.py::test_check_understood_rrule tests/ui/test_editor.py::test_convert_to_date
khal/ui/editor.py
khal/ui/editor.py