RecurringInfo and CalculateDays function - RecurringEndType change not respected?

Hi everybody

 

When i'm trying to change the End date of the recurrence info object, the CalculateDays function returns the StartDate as the EndDate for some reason. Is there something i'm doing wrong?

 

I change the RecurrenceCounter to -1 and the RecurrenceEndType to 2, and then running the CalculateDays function.

Please have a look at the object before:

{
  "Pattern": 2,
  "RecurrenceCounter": -1,
  "RecurrenceEndType": 2,
  "RecurrenceId": 3320,
  "IsRecurrence": true,
  "EndDate": "2021-08-03 16:30:00",
  "StartDate": "2020-08-04 00:00:00",
  "dayPattern": {
    "Cycle": 1,
    "Pattern": 3
  },
  "monthPattern": {
    "Cycle": 1,
    "Day": 1,
    "Weekday": 2,
    "Pattern": 4,
    "WeekOfMonth": 1
  },
  "weekPattern": {
    "Cycle": 1,
    "Weekday": 2
  },
  "yearPattern": {
    "Cycle": 12,
    "Day": 1,
    "Weekday": 2,
    "Pattern": 6,
    "WeekOfMonth": 1
  },
  "recurrenceDate": [
    {
      "IsConflict": false,
      "Date": "2020-12-01 00:00:00",
      "Description": "",
      "DescriptionStyleHint": "",
      "Tooltip": ""
    },.....
  ]
}

And the returned object after running CalculateDays:

{
  "Pattern": 2,
  "RecurrenceCounter": 1,
  "RecurrenceEndType": 2,
  "RecurrenceId": 3320,
  "IsRecurrence": true,
  "EndDate": "2020-08-04 00:00:00",
  "StartDate": "2020-08-04 00:00:00",
  "dayPattern": {
    "Cycle": 1,
    "Pattern": 3
  },
  "monthPattern": {
    "Cycle": 1,
    "Day": 1,
    "Weekday": 2,
    "Pattern": 4,
    "WeekOfMonth": 1
  },
  "weekPattern": {
    "Cycle": 1,
    "Weekday": 2
  },
  "yearPattern": {
    "Cycle": 12,
    "Day": 1,
    "Weekday": 2,
    "Pattern": 6,
    "WeekOfMonth": 1
  },
  "recurrenceDate": [
    {
      "IsConflict": false,
      "Date": "2020-08-04 00:00:00",
      "Description": "",
      "DescriptionStyleHint": "",
      "Tooltip": ""
    }
  ]
}

As you can see, EndDate and StartDate are suddenly equal?

So the question is, how do i change from RecurrenceEndType 1 to 2 (Using end time instead of counter) - using EndType 1 works perfectly.

 

thanks

RE: RecurringInfo and CalculateDays function - RecurringEndType change not respected?

When you set RecurringEndType to 2, you are expected to specify the number of occurances it should calculate. The RecurrenceCounter property is used to determine the number of times the reoccurance should occur. Setting this to -1 basically means you do not want any reoccurrances. 

 

In other words, when RecurringEndType is 2, EndDate is ignored. EndDate is used when RecurringEndType is 1 (EndDate)

 

Make sense?

Av: Tony Yates 3. dec 2020

RE: RecurringInfo and CalculateDays function - RecurringEndType change not respected?

Hi Tony, seems like i made a f*ck up, switching the values of recurring endtype as you pointed out. Weird i didn't see that...

 

Thanks as always :)

Av: Dennis Mortensgaard 7. dec 2020