Skip to content

Commit

Permalink
Grunt Package
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Pandian committed Aug 19, 2017
1 parent 813afd9 commit 8289538
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
37 changes: 36 additions & 1 deletion build/ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -6974,12 +6974,26 @@ ICAL.RecurIterator = (function() {
throw new Error("BYYEARDAY may only appear in YEARLY rules");
}


this.sort_bypart_rules("BYSECOND", parts);
this.last.second = this.setup_defaults("BYSECOND", "SECONDLY", this.dtstart.second);

this.sort_bypart_rules("BYMINUTE", parts);
this.last.minute = this.setup_defaults("BYMINUTE", "MINUTELY", this.dtstart.minute);

this.sort_bypart_rules("BYHOUR", parts);
this.last.hour = this.setup_defaults("BYHOUR", "HOURLY", this.dtstart.hour);
this.last.day = this.setup_defaults("BYMONTHDAY", "DAILY", this.dtstart.day);

this.sort_bypart_rules("BYMONTH", parts);
this.last.month = this.setup_defaults("BYMONTH", "MONTHLY", this.dtstart.month);

//setting day after month, as sorting BYMONTHDAY will differ based on the month
//-2 < 28 in Feb, -2 > 28 in march
this.sort_bypart_rules("BYMONTHDAY", parts);
this.last.day = this.setup_defaults("BYMONTHDAY", "DAILY", this.dtstart.day);

this.sort_bypart_rules("BYYEARDAY", parts);

if (this.rule.freq == "WEEKLY") {
if ("BYDAY" in parts) {
var bydayParts = this.ruleDayOfWeek(parts.BYDAY[0]);
Expand Down Expand Up @@ -8063,6 +8077,27 @@ ICAL.RecurIterator = (function() {
return false;
},

sort_bypart_rules: function icalrecur_sort_bypart(aPartName, aParts) {
if (aPartName in aParts) {
var offset = 0;
if (aPartName == "BYYEARDAY") {
offset = ICAL.Time.isLeapYear(this.last.year)? 367 : 366;
} else if (aPartName == "BYMONTHDAY") {
offset = ICAL.Time.daysInMonth(this.last.month, this.last.year) + 1;
}
var comparator = function(a, b) {
if (a < 0) {
a += offset;
}
if (b < 0) {
b += offset;
}
return a - b;
};
aParts[aPartName].sort(comparator);
}
},

sort_byday_rules: function icalrecur_sort_byday_rules(aRules, aWeekStart) {
for (var i = 0; i < aRules.length; i++) {
for (var j = 0; j < i; j++) {
Expand Down
2 changes: 1 addition & 1 deletion build/ical.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/ical.min.js.map

Large diffs are not rendered by default.

0 comments on commit 8289538

Please sign in to comment.