Fix conversion of UNTIL date in RRULEs to EAS calendar dates

* Because we were sending these in the wrong format, upsynced changes
  were failing, with the result that both the original event and
  the "new" event (from the UNTIL date forward) remained in the calendar
* Fix is to send the proper format; unit test updated to reflect the
  change
* Also, we only send the date of an UNTIL, rather than the to-the-minute
  time; it turns out that EAS expects to see only a day for UNTIL.

Bug: 2561818
Change-Id: Ic4eacbe96c713d58c637386ceab2cf22ebe3c2d4
This commit is contained in:
Marc Blank 2010-03-31 22:03:10 -07:00
parent 1c48450c02
commit cf274512ed
2 changed files with 5 additions and 17 deletions

View File

@ -954,21 +954,9 @@ public class CalendarUtilities {
static String recurrenceUntilToEasUntil(String until) {
StringBuilder sb = new StringBuilder();
sb.append(until.substring(0, 4));
sb.append('-');
sb.append(until.substring(4, 6));
sb.append('-');
if (until.length() == 8) {
sb.append(until.substring(6, 8));
sb.append("T00:00:00");
} else {
sb.append(until.substring(6, 11));
sb.append(':');
sb.append(until.substring(11, 13));
sb.append(':');
sb.append(until.substring(13, 15));
}
sb.append(".000Z");
sb.append(until.substring(6, 8));
sb.append("T000000Z");
return sb.toString();
}

View File

@ -139,11 +139,11 @@ public class CalendarUtilitiesTests extends AndroidTestCase {
}
public void testRecurrenceUntilToEasUntil() {
// Test full formatCC
assertEquals("YYYY-MM-DDTHH:MM:SS.000Z",
// Test full format
assertEquals("YYYYMMDDT000000Z",
CalendarUtilities.recurrenceUntilToEasUntil("YYYYMMDDTHHMMSSZ"));
// Test date only format
assertEquals("YYYY-MM-DDT00:00:00.000Z",
assertEquals("YYYYMMDDT000000Z",
CalendarUtilities.recurrenceUntilToEasUntil("YYYYMMDD"));
}