mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-6356 Correct repeating events handling of the last instance by day
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32282 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -201,6 +201,18 @@ public class CalendarHelpersTest
|
|||||||
assertEquals("2011-07-29", dateFmt.format(dates.get(9)));
|
assertEquals("2011-07-29", dateFmt.format(dates.get(9)));
|
||||||
|
|
||||||
|
|
||||||
|
// From before today, full time set
|
||||||
|
dates.clear();
|
||||||
|
currentDate.set(2011,11-1,24,10,30);
|
||||||
|
RecurrenceHelper.buildDailyRecurrences(
|
||||||
|
currentDate, dates, null,
|
||||||
|
date(2011,11,22,12,30), date(2011,11,25,12,30),
|
||||||
|
false, 1);
|
||||||
|
assertEquals(2, dates.size());
|
||||||
|
assertEquals("2011-11-24", dateFmt.format(dates.get(0))); // Thu
|
||||||
|
assertEquals("2011-11-25", dateFmt.format(dates.get(1))); // Fri
|
||||||
|
|
||||||
|
|
||||||
// With no end date but only first, check it behaves
|
// With no end date but only first, check it behaves
|
||||||
dates.clear();
|
dates.clear();
|
||||||
currentDate.set(2011,7-1,19,10,30);
|
currentDate.set(2011,7-1,19,10,30);
|
||||||
@@ -269,6 +281,17 @@ public class CalendarHelpersTest
|
|||||||
assertEquals("2011-07-25", dateFmt.format(dates.get(1))); // Mon
|
assertEquals("2011-07-25", dateFmt.format(dates.get(1))); // Mon
|
||||||
|
|
||||||
|
|
||||||
|
// Just before today, full time set
|
||||||
|
dates.clear();
|
||||||
|
currentDate.set(2011,11-1,24,10,30);
|
||||||
|
RecurrenceHelper.buildWeeklyRecurrences(
|
||||||
|
currentDate, dates, params,
|
||||||
|
date(2011,11,22,12,30), date(2011,11,25,12,30),
|
||||||
|
false, 1);
|
||||||
|
assertEquals(1, dates.size());
|
||||||
|
assertEquals("2011-11-24", dateFmt.format(dates.get(0))); // Thu
|
||||||
|
|
||||||
|
|
||||||
// From today
|
// From today
|
||||||
dates.clear();
|
dates.clear();
|
||||||
currentDate.set(2011,7-1,19,10,30);
|
currentDate.set(2011,7-1,19,10,30);
|
||||||
|
@@ -127,7 +127,8 @@ public class CalendarRecurrenceHelper
|
|||||||
* For the given Calendar Entry, return its subsequent Recurrence on or after
|
* For the given Calendar Entry, return its subsequent Recurrence on or after
|
||||||
* the specified date, until the given limit. If it doesn't have any recurrences
|
* the specified date, until the given limit. If it doesn't have any recurrences
|
||||||
* on or after the start date (either no recurrence rules, or the last recurrence
|
* on or after the start date (either no recurrence rules, or the last recurrence
|
||||||
* date is before then), null will be returned.
|
* date is before then), null will be returned. (The onOrAfter and until dates
|
||||||
|
* are treat as inclusive)
|
||||||
* If requested, can stop after the first hit
|
* If requested, can stop after the first hit
|
||||||
* @return The next recurrence on or after the given date, or null if there aren't any
|
* @return The next recurrence on or after the given date, or null if there aren't any
|
||||||
*/
|
*/
|
||||||
@@ -143,7 +144,8 @@ public class CalendarRecurrenceHelper
|
|||||||
* For the given Calendar Entry, return its subsequent Recurrence on or after
|
* For the given Calendar Entry, return its subsequent Recurrence on or after
|
||||||
* the specified date, until the given limit. If it doesn't have any recurrences
|
* the specified date, until the given limit. If it doesn't have any recurrences
|
||||||
* on or after the start date (either no recurrence rules, or the last recurrence
|
* on or after the start date (either no recurrence rules, or the last recurrence
|
||||||
* date is before then), null will be returned.
|
* date is before then), null will be returned. (The onOrAfter and until dates
|
||||||
|
* are treat as inclusive)
|
||||||
* If requested, can stop after the first hit
|
* If requested, can stop after the first hit
|
||||||
* @return The next recurrence on or after the given date, or null if there aren't any
|
* @return The next recurrence on or after the given date, or null if there aren't any
|
||||||
*/
|
*/
|
||||||
@@ -273,7 +275,7 @@ public class CalendarRecurrenceHelper
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Run until the end
|
// Run until the end
|
||||||
while (currentDate.getTime().before(until))
|
while (! currentDate.getTime().after(until))
|
||||||
{
|
{
|
||||||
dates.add(currentDate.getTime());
|
dates.add(currentDate.getTime());
|
||||||
currentDate.add(Calendar.DATE, 1);
|
currentDate.add(Calendar.DATE, 1);
|
||||||
|
Reference in New Issue
Block a user