@@ -396,16 +396,17 @@ static const struct recur_map {
396396 const char * str ;
397397 int size ;
398398 int min ;
399+ int isTime ;
399400} recur_map [] = {
400- {"BYMONTH" , ICAL_BY_MONTH_SIZE , 1 },
401- {"BYWEEKNO" , ICAL_BY_WEEKNO_SIZE , -1 },
402- {"BYYEARDAY" , ICAL_BY_YEARDAY_SIZE , -1 },
403- {"BYMONTHDAY" , ICAL_BY_MONTHDAY_SIZE , -1 },
404- {"BYDAY" , ICAL_BY_DAY_SIZE , 0 },
405- {"BYHOUR" , ICAL_BY_HOUR_SIZE , 0 },
406- {"BYMINUTE" , ICAL_BY_MINUTE_SIZE , 0 },
407- {"BYSECOND" , ICAL_BY_SECOND_SIZE , 0 },
408- {"BYSETPOS" , ICAL_BY_SETPOS_SIZE , -1 },
401+ {"BYMONTH" , ICAL_BY_MONTH_SIZE , 1 , 0 },
402+ {"BYWEEKNO" , ICAL_BY_WEEKNO_SIZE , -1 , 0 },
403+ {"BYYEARDAY" , ICAL_BY_YEARDAY_SIZE , -1 , 0 },
404+ {"BYMONTHDAY" , ICAL_BY_MONTHDAY_SIZE , -1 , 0 },
405+ {"BYDAY" , ICAL_BY_DAY_SIZE , 0 , 0 },
406+ {"BYHOUR" , ICAL_BY_HOUR_SIZE , 0 , 1 },
407+ {"BYMINUTE" , ICAL_BY_MINUTE_SIZE , 0 , 1 },
408+ {"BYSECOND" , ICAL_BY_SECOND_SIZE , 0 , 1 },
409+ {"BYSETPOS" , ICAL_BY_SETPOS_SIZE , -1 , 0 },
409410};
410411
411412static const char * icalrecur_first_clause (struct icalrecur_parser * parser )
@@ -1162,7 +1163,14 @@ static void setup_defaults(icalrecur_iterator *impl,
11621163{
11631164 icalrecurrencetype_frequency freq = impl -> rule -> freq ;
11641165
1165- if (expand_map [freq ].map [byrule ] == EXPAND ) {
1166+ if (impl -> dtstart .is_date && recur_map [byrule ].isTime ) {
1167+ // The BYSECOND, BYMINUTE and BYHOUR rule parts MUST NOT be specified
1168+ // when the associated "DTSTART" property has a DATE value type.
1169+ // These rule parts MUST be ignored in RECUR value that violate the
1170+ // above requirement (e.g., generated by applications that pre-date
1171+ // this revision of iCalendar).
1172+ recur_iterator_set_static_single_by_value (impl , byrule , 0 );
1173+ } else if (expand_map [freq ].map [byrule ] == EXPAND ) {
11661174 /* Re-write the BY rule arrays with data from the DTSTART time so
11671175 we don't have to explicitly deal with DTSTART */
11681176 if (impl -> bydata [byrule ].by .size == 0 ) {
0 commit comments