From 3607875714c33bd296fb19731880979a7c1d4a2c Mon Sep 17 00:00:00 2001 From: henglert Date: Thu, 29 Dec 2016 15:31:01 +0100 Subject: [PATCH] Fix repeating count of yearly calendar events The occurrence counter for a yearly repeating event e was calculated by "current year" - "e.firstYear", instead of "e.year" - "e.firstYear". That leads to a repeating event counter - 1 at the end of the year. E.g. event e: first Date: 2015-01-02, yearly repetition repeating count evaluated on 2015-12-31: 2015-2015 = 0 => incorrect repeating count evaluated on 2016-01-01: 2016-2015 = 1 => correct Fix: repeating count has to be calculated from event date instead of current date. --- modules/default/calendar/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 3b6639df..3e0a0985 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -134,7 +134,7 @@ Module.register("calendar", { repeatingCountTitle = this.countTitleForUrl(event.url); if (repeatingCountTitle !== "") { - var thisYear = new Date().getFullYear(), + var thisYear = new Date(parseInt(event.startDate)).getFullYear(), yearDiff = thisYear - event.firstYear; repeatingCountTitle = ", " + yearDiff + ". " + repeatingCountTitle;