Event: fix date calculation to account for exact same dates.

master
Tom Hacohen 6 years ago
parent 8b81d79c5b
commit 09ddfe8be8

@ -24,9 +24,13 @@ function formatDateRange(start: ICAL.Time, end: ICAL.Time) {
strStart = mStart.format(allDayFormat); strStart = mStart.format(allDayFormat);
strEnd = mEnd.clone().subtract(1, 'day').format(allDayFormat); strEnd = mEnd.clone().subtract(1, 'day').format(allDayFormat);
} }
} else if ((mStart.day === mEnd.day) && (mEnd.diff(mStart, 'days', true) < 1)) { } else if (mStart.isSame(mEnd, 'day')) {
strStart = mStart.format(fullFormat); strStart = mStart.format(fullFormat);
strEnd = mEnd.format('LT'); strEnd = mEnd.format('LT');
if (mStart.isSame(mEnd)) {
return strStart;
}
} else { } else {
strStart = mStart.format(fullFormat); strStart = mStart.format(fullFormat);
strEnd = mEnd.format(fullFormat); strEnd = mEnd.format(fullFormat);

Loading…
Cancel
Save