From 78c19fe7c424580ab2cb1cbc06d25986bfb5236a Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 29 Dec 2017 12:19:28 +0000 Subject: [PATCH] Fix one-day long allDay events. --- src/components/EventEdit.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/EventEdit.tsx b/src/components/EventEdit.tsx index e5ede0a..c899239 100644 --- a/src/components/EventEdit.tsx +++ b/src/components/EventEdit.tsx @@ -131,15 +131,15 @@ class EventEdit extends React.PureComponent { const startDate = ICAL.Time.fromString(this.state.start); let endDate = ICAL.Time.fromString(this.state.end); + if (this.state.allDay) { + endDate.adjust(1, 0, 0, 0); + } + if (startDate.compare(endDate) >= 0) { this.setState({error: 'End time must be later than start time!'}); return; } - if (this.state.allDay) { - endDate.adjust(1, 0, 0, 0); - } - let event = (this.props.item) ? this.props.item.clone() :