search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Is there a way of excluding specific days of the week (Sat/Sun) or of excluding specific days with RecurrenceExpand.Expand

Asked by mrplatypus (aka Dave)
7 years ago.

Dear Support Team,

The application I'm currently working with typically works Monday through Friday.

I am using the RecurrenceExpander.Expand method to generate a table of planned future dates for a recurring event.

Is there a way of excluding specific days of the week (Saturdays, Sundays) or of excluding specific days (25th December, 1st January) from the year?

Please help.

Thanks & Regards

mrplatypus, aka Dave.

Comment posted by mrplatypus (aka Dave)
7 years ago.

As an update to this and through looking on the forums site, I've found this:
http://www.daypilot.org/api/pro/latest/html/M_DayPilot_Web_Ui_Recurrence_RecurrenceRule_Weekly_1.htm

I've also found this:
http://www.daypilot.org/api/pro/latest/html/F_DayPilot_Web_Ui_Recurrence_RecurrenceRule_Units.htm

Seems to indicate that my requirements is/are possible?

Answer posted by Dan Letecky [DayPilot]
7 years ago.

Yes, for skipping the weekend the rule would by "weekly" and the list of days would include Monday...Friday:

RecurrenceRule rule =
    RecurrenceRule.FromDateTime("1", DateTime.Today)
        .Weekly(new DayOfWeek[]
            {DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday,});

For excluding exact days of year it will be necessary to post-process the result set manually and remove the occurrences. Just note that if the rule specifies a fixed number of occurrences this may produce undesired result (too few occurrences).

Comment posted by mrplatypus (aka Dave)
7 years ago.

Dan,

Thanks for the information - I asked specifically about specific days, to take into consideration Bank Holidays, Christmas Day, New Years Day etc..
I was hoping not to have to iterate through the resultset of all days etc but if that is the only way then that will have to do.

Thanks again.

mrplatypus (aka Dave)

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.