1.1 --- a/imip_manager.py Tue Feb 03 19:29:38 2015 +0100
1.2 +++ b/imip_manager.py Tue Feb 03 19:31:08 2015 +0100
1.3 @@ -35,7 +35,7 @@
1.4 Object, to_part
1.5 from imiptools.dates import format_datetime, get_datetime, get_datetime_item, \
1.6 get_end_of_day, get_start_of_day, get_start_of_next_day, \
1.7 - get_timestamp, ends_on_same_day, to_timezone
1.8 + get_timestamp, ends_on_same_day, next_date, to_timezone
1.9 from imiptools.mail import Messenger
1.10 from imiptools.period import add_day_start_points, add_slots, convert_periods, \
1.11 get_freebusy_details, \
1.12 @@ -378,12 +378,29 @@
1.13
1.14 for slot in slots:
1.15 start, end = slot.split("-")
1.16 + end = end or next_date(start)
1.17 +
1.18 if last:
1.19 - if start == last[1]:
1.20 - last = last[0], end
1.21 + last_start, last_end = last
1.22 +
1.23 + # Merge adjacent dates and datetimes.
1.24 +
1.25 + if start == last_end:
1.26 + last = last_start, end
1.27 continue
1.28 +
1.29 + # Handle datetimes within dates.
1.30 + # Datetime periods are within single days and are therefore
1.31 + # discarded.
1.32 +
1.33 + elif start.startswith(last_start):
1.34 + continue
1.35 +
1.36 + # Add separate dates and datetimes.
1.37 +
1.38 else:
1.39 coalesced.append(last)
1.40 +
1.41 last = start, end
1.42
1.43 if last: