Our pure JavaScript Scheduler component


Post by Gopika »

Hi Team,

https://www.bryntum.com/docs/scheduler/#Scheduler/model/mixin/RecurringTimeSpan#function-addExceptionDate

I was going through ExceptionDate. So when I edit a recurring event and click on "only this event", I can see in the payload it adds exception dates. So for an event I should save this as a DateTime field in database or is it a list of exceptional dates?

And when we call load from crudManager, how should we send it in the Json. I was not able to see a json sample with exception dates.

Any pointers would be great


Post by alex.l »

Hi Gopika,

It is an Array, check here: https://www.bryntum.com/docs/scheduler/#Scheduler/model/mixin/RecurringTimeSpan#field-exceptionDates
You can use both for your JSON: an array String[] or a String, using comma to separate values.

All best,
Alex

All the best,
Alex


Post by Gopika »

Hi,

I had created a string field exceptionDates in DB.
I am using the asp.net core demo as backend.

So first time when I try to update an occurance in the reccuring events, I see that it send the exception dates in the updated object and saves in the db.

Next time when I try to update another event in the same recurring events, I get error.
The json that is send is

{
   "type":"sync",
   "requestId":15973978724503,
   "revision":1,
   "events":{
      "added":[
         {
            "resourceId":"10",
            "recurringTimeSpanId":null,
            "recurrenceRule":null,
            "exceptionDates":[
               "2020-08-12T11:30:00.000Z"
            ],
            "startDate":"2020-08-13T11:30:00.000Z",
            "endDate":"2020-08-13T15:30:00.000Z",
            "duration":0.16666666666666666,
            "durationUnit":"d",
            "cls":"",
            "name":"",
            "$PhantomId":"_generated_0x5c177b18"
         }
      ],
      "updated":[
         {
            "exceptionDates":[
               "2020-08-12T11:30:00.000Z",
               "2020-08-13T11:30:00.000Z"
            ],
            "id":297
         }
      ]
   }
}


The error I get is Unexpected character encountered while parsing value: [. Path 'events.added[0].exceptionDates', line 1, position 264.

I am not sure what is happening. Can you help me!

Thanks.


Post by Maxim Gorkovsky »

Hello. It looks like a backend issue. Have you added exceptionDates field to the event model? How do you define it?


Post by Gopika »

Yes I have defined it.

public string ExceptionDates { get; set; }

Also when we edit second time, that new event should have a exception date? It should be null right in the added object?


Post by Maxim Gorkovsky »

public string ExceptionDates { get; set; }

backend expects a string and client passes array of strings.

Also why does when we edit second time, that event should have a exception date? It should be null right in the added object?

I cannot reproduce this issue on backend demo with recurrence enabled. Probably server doesn't tell client exception dates are updated.
e.g. Assuming you're using crud manager, response to this request:

"updated":[
         {
            "exceptionDates":[
               "2020-08-12T11:30:00.000Z",
               "2020-08-13T11:30:00.000Z"
            ],
            "id":297
         }
      ]

should include:

"rows":[{ "id":297 }]

Post by Gopika »

Yes, the response is having that

{
        "events": {
        "rows": [
            {
                "id": 297
            }
        ],
        "removed": null
    },
    "revision": 1,
    "success": true,
    "requestId": 15973978724503
}

Actually the array of strings I am converting to string before inserting to db. Hope that step is fine.


Post by Maxim Gorkovsky »

Actually the array of strings I am converting to string before inserting to db. Hope that step is fine.

Model is used in deserializing JSON into class instances. If you want to change field type on the backend you'll have to use two fields: one to serialize/deserialize JSON and other to store data to DB. Please refer to the net core json library documentation. This question is really out of the scope of this forum as it is related to .NET Core.

Speaking of exceptionDates constantly appearing in sync request, we'd need a runnable test to inspect this behavior, because I cannot reproduce it on our end. Please provide one and we will take a look. Backend is not required, you can include 1-2 server responses instead.


Post by Gopika »

exceptionDates.JPG
exceptionDates.JPG (68.64 KiB) Viewed 1130 times

Just for information, attaching the sync request I got in payload.

I am using * Bryntum Scheduler 3.1.7 (TRIAL VERSION)


Post by Maxim Gorkovsky »

This screenshot is not informative. It shows request data, not the response.


Post Reply