Dear Customer,
Syncfusion greetings.
By default, Scheduler will send the data in 0 UTC to server which is the cause. Custom adaptor can be used to achieve your requirement like below.
class CustomAdaptor extends UrlAdaptor {
public beforeSend(args: DataManager, xhr: XMLHttpRequest) {
console.log(xhr);
xhr.withCredentials = true;
super.beforeSend(args, xhr);
}
processQuery(dm, query, hierarchyFilters): Object {
let req = {};
let r = {
sorted: [],
grouped: [],
filters: [],
searches: [],
aggregates: []
};
let filterQueryLists = function (queries, singles) {
let filtered = queries.filter(function (q) {
return singles.indexOf(q.fn) !== -1;
}), res = {};
for (let i = 0; i < filtered.length; i++) {
if (!res[filtered[i].fn])
res[filtered[i].fn] = filtered[i].e;
}
return res;
};
let callAdaptorFunc = function (obj, fnName, param, param1) {
if (obj[fnName]) {
let res = obj[fnName](param, param1);
if (!isNull(res)) param = res;
}
return param;
};
let getValue = function (value, inst) {
if (typeof value === "function")
return value.call(inst || {});
return value;
};
let isNull = function (val) {
return val === undefined || val === null;
};
let singles = filterQueryLists(query.queries, ["onSelect", "onPage", "onSkip", "onTake", "onRange"]);
let op = this.options;
req[op.from] = query._fromTable;
if (op.expand) req[op.expand] = query._expands;
req[op.select] = singles["onSelect"] ? callAdaptorFunc(this, "onSelect", getValue(singles["onSelect"].fieldNames, query), query) : "";
req[op.count] = query._requiresCount ? callAdaptorFunc(this, "onCount", query._requiresCount, query) : "";
req[op.search] = r.searches.length ? callAdaptorFunc(this, "onSearch", r.searches, query) : "";
req[op.skip] = singles["onSkip"] ? callAdaptorFunc(this, "onSkip", getValue(singles["onSkip"].nos, query), query) : "";
req[op.take] = singles["onTake"] ? callAdaptorFunc(this, "onTake", getValue(singles["onTake"].nos, query), query) : "";
req[op.where] = r.filters.length || r.searches.length ? callAdaptorFunc(this, "onWhere", r.filters, query) : "";
req[op.sortBy] = r.sorted.length ? callAdaptorFunc(this, "onSortBy", r.sorted, query) : "";
req[op.group] = r.grouped.length ? callAdaptorFunc(this, "onGroup", r.grouped, query) : "";
req[op.aggregates] = r.aggregates.length ? callAdaptorFunc(this, "onAggregates", r.aggregates, query) : "";
req["param"] = [];
if (this.options.requestType === "json") {
return {
data: JSON.stringify(req),
url: 'http://localhost:54738/Home/LoadData?' + query.params[0].key + '=' + this.removeTimzeOffset(query.params[0].value) + '&' + query.params[1].key + '=' + this.removeTimzeOffset(query.params[1].value),
type: "POST",
contentType: "application/json; charset=utf-8"
}
}
}
removeTimzeOffset(value) {
// To add offset with StartDate and EndDate
let targetTime = new Date(value);
let tzDifference = new Date().getTimezoneOffset();
return new Date(targetTime.getTime() - (tzDifference * 60 * 1000)).toISOString()
}
}
private dataManager: DataManager = new DataManager({
url: 'http://localhost:54738/Home/LoadData',
crudUrl: 'http://localhost:54738/Home/UpdateData',
adaptor: new CustomAdaptor,
crossDomain: true
});
Regards,
Karthi