From cf274512ed722cd039e21ab05ce172052740116f Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 31 Mar 2010 22:03:10 -0700 Subject: [PATCH] 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 --- .../exchange/utility/CalendarUtilities.java | 16 ++-------------- .../exchange/utility/CalendarUtilitiesTests.java | 6 +++--- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/com/android/exchange/utility/CalendarUtilities.java b/src/com/android/exchange/utility/CalendarUtilities.java index 1c2ddce30..feec1a9fe 100644 --- a/src/com/android/exchange/utility/CalendarUtilities.java +++ b/src/com/android/exchange/utility/CalendarUtilities.java @@ -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(); } diff --git a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java index 0c6c39732..0a8396450 100644 --- a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java +++ b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java @@ -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")); }