Fix recurrence parsing for all-day events.

The doozer server requires P1D instead of P86400S for all-day events.

bug=1594638
This commit is contained in:
Ken Shirriff
2009-08-21 14:21:59 -07:00
parent 00ddbcaa2e
commit 1ce2e2e78d

View File

@@ -410,10 +410,14 @@ public static boolean populateComponent(ContentValues values,
Time end = new Time(endTzid);
end.parse(dtendProperty.getValue());
long durationMillis = end.toMillis(false /* use isDst */)
long durationMillis = end.toMillis(false /* use isDst */)
- start.toMillis(false /* use isDst */);
long durationSeconds = (durationMillis / 1000);
return "P" + durationSeconds + "S";
if (start.allDay && (durationSeconds % 86400) == 0) {
return "P" + (durationSeconds / 86400) + "D"; // Server wants this instead of P86400S
} else {
return "P" + durationSeconds + "S";
}
}
private static String flattenProperties(ICalendar.Component component,