Customize StartDate and EndDate query parameters

Hello folks,

I use scheduler to show events in specified time zone:

<ScheduleComponent timezone='Europe/London' />

And I expect that StartDate and EndDate query parameters would be sent in the same timezone: https://{api-url}?StartDate=2023-08-22T23:00:00.000Z&EndDate=2023-08-23T23:00:00.000Z

But when my PC in, say, Coordinated Universal time with minus 9 hours offset the request looks like:  https://{api-url}?StartDate=2023-08-23T09:00:00.000Z&EndDate=2023-08-24T09:00:00.000Z


My backend doesn't know about browser timezone. Could you please tell me how can I make  StartDate and EndDate parameters to be dependent on time zone parameter which I pass to schedule instead of browser timezone? 


5 Replies

IP Ivan Pohorilyi August 24, 2023 08:12 AM UTC

Dear Syncfution team, we consider this as a bug and we made a fix on our side by overriding part of your query building functionality:

import { Predicate } from '@syncfusion/ej2-data';

import { Data } from '@syncfusion/ej2-schedule/src/schedule/actions/data'

import { zonedTimeToUtc } from 'date-fns-tz'


Data.prototype.generateQuery = function (startDate, endDate) {

    var query = this["query"].clone();

    if (this["parent"] && this["parent"].eventSettings.includeFiltersInQuery && startDate && endDate) {

        var dateQuery = this.getStartEndQuery(startDate, endDate);

        var recurrenceQuery = new Predicate(this["parent"].eventFields.recurrenceRule, 'notequal', null).and(new Predicate(this["parent"].eventFields.recurrenceRule, 'notequal', ''));

        return query.where(dateQuery.or(recurrenceQuery));

    }

    const timeZone = this["parent"].timezone;

    if (startDate) {

        query.addParams('StartDate', (timeZone ? zonedTimeToUtc(startDate, timeZone) : startDate).toISOString());

    }

    if (endDate) {

        query.addParams('EndDate', (timeZone ? zonedTimeToUtc(endDate, timeZone) : endDate).toISOString());

    }

    return query;

};


We'd appreciate if you fix it on your side in one of closest releases.


Cheers,

Ivan



SR Swathi Ravi Syncfusion Team August 24, 2023 11:31 AM UTC

Hi Ivan,

 

Your reported problem The start and end dates' time zone is being passed incorrectlyis considered as a bug. The fix for this defect will be included in our upcoming weekly patch release, which is expected to be rolled out by first week of September 2023. You can track the status of the fix at the following link:

 

Feedback : https://www.syncfusion.com/feedback/46372/the-start-and-end-dates-time-zone-is-being-passed-incorrectly

 

Regards,

Swathi Ravi



IP Ivan Pohorilyi August 25, 2023 08:17 AM UTC

Thank you, guys.


Regards,

Ivan



SK Satheesh Kumar Balasubramanian Syncfusion Team August 28, 2023 09:23 AM UTC

Hi Ivan,


Thanks for the update.

We will let you know once the patch is published.

Regards,

Satheesh Kumar B



SK Satheesh Kumar Balasubramanian Syncfusion Team September 22, 2023 01:37 PM UTC

Hi Ivan,


We are glad to announce that our Essential Studio 2023 Volume 3 release v23.1.36 is rolled out and is available for download under the following link.


https://www.syncfusion.com/forums/184588/essential-studio-2023-volume-3-main-release-v23-1-36-is-available-for-download


The fix for the issue The start and end dates' time zone is being passed incorrectly” has been included in our volume 3 release v23.1.36. Upgrade to the latest version to resolve the issue.


Sample: https://stackblitz.com/edit/ej2-react-schedule-start-end-timezone?file=package.json,index.js


Regards,

Satheesh


Loader.
Up arrow icon