Fix bug in formatting intervals at month boundaries.
In formatting date intervals, we subtract one day from the end time
if it falls on midnight the next day so that both times are in the
same day, thereby avoiding the date appearing in the formatted
interval. We did this by calling endCalendar.roll(Calendar.DAY_OF_MONTH, false).
However, if endCalendar was 1 May 2015 (say), the date rolls over
to 31 May 2015 (this is the documented behaviour of roll).
We now use endCalendar.add(Calendar.DAY_OF_MONTH, -1) which always
subtracts a day so that 1 May 2015 becomes 30 April 2015, this is
the desired behavior.
bug: 20708022
Change-Id: Id222582b26170a91a4ce2f4b5ebef3c15bce7c92
3 files changed