Incorrect startDate and endDate between drag and drop

Discuss issues related to v5.x
Post Reply
User avatar
pier77
Premium Member
Premium Member
Posts: 33
Joined: Thu Dec 01, 2016 12:36 pm

Incorrect startDate and endDate between drag and drop

Post by pier77 » Fri Jul 26, 2019 12:23 pm

Dear Support,

I have problem with drag and drop of the an item on the Scheduler. We I drag an item the tooltip shows start date and end date (08/06/2019 to 11/06/2019) instead in the event "beforeeventdropfinalize" the object "dragContext" has the end date + 1 Day (from 08/06/2019 to 12/06/2019)

Should you help me?
Thanks
Pier
Attachments
drag.png
drag.png (12.04 KiB) Viewed 1047 times

User avatar
mats
Core Developer
Core Developer
Posts: 15590
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Incorrect startDate and endDate between drag and drop

Post by mats » Fri Jul 26, 2019 1:43 pm

It's correct behavior, the end date is 'exclusive' - a point in time. Meaning it's the full day of the previous day in the UI. In data this

Code: Select all

(08/06/2019 to 11/06/2019)
is represented as

Code: Select all

(08/06/2019 00:00:00 to 12/06/2019 00:00:00)
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
pier77
Premium Member
Premium Member
Posts: 33
Joined: Thu Dec 01, 2016 12:36 pm

Re: Incorrect startDate and endDate between drag and drop

Post by pier77 » Fri Jul 26, 2019 1:59 pm

Dear Mats,
thanks for a quick reply. In the my app the start and date are included (image item.png). Is there a way to include the end date?
Attachments
item.png
item.png (12.93 KiB) Viewed 1041 times

User avatar
pier77
Premium Member
Premium Member
Posts: 33
Joined: Thu Dec 01, 2016 12:36 pm

Re: Incorrect startDate and endDate between drag and drop

Post by pier77 » Fri Jul 26, 2019 5:01 pm

Dear Mats,

if is not possible include the end date, I can customize the tooltip?

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Incorrect startDate and endDate between drag and drop

Post by pmiklashevich » Mon Jul 29, 2019 11:17 am

You can override private getFormattedEndDate function which is responsible for preparing date string for all tooltips in scheduler based on displayDateFormat value (might be overridden in localization) to use getFormattedDate function internally:

Code: Select all

Ext.define(null, {
    override            : 'Sch.mixin.AbstractTimelineView',
    getFormattedEndDate : function (endDate, startDate) {
        return this.getFormattedDate(endDate);
    }
});
Pavel Miklashevich - Core Developer

User avatar
pier77
Premium Member
Premium Member
Posts: 33
Joined: Thu Dec 01, 2016 12:36 pm

Re: Incorrect startDate and endDate between drag and drop

Post by pier77 » Tue Jul 30, 2019 1:56 pm

Hi pmiklashevich,

In my version in the class AbstractTimelineView there is not the method getFormattedEndDate. Should you check the Class?
Version:5.1.10

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Incorrect startDate and endDate between drag and drop

Post by pmiklashevich » Tue Jul 30, 2019 2:24 pm

I've just checked out to v5.1.10 and I can clearly see both getFormattedEndDate and getFormattedDate in Sch.mixin.AbstractTimelineView class. Try to download new zip of 5.1.10 from customer zone to make sure this code is there?
Pavel Miklashevich - Core Developer

User avatar
pier77
Premium Member
Premium Member
Posts: 33
Joined: Thu Dec 01, 2016 12:36 pm

Re: Incorrect startDate and endDate between drag and drop

Post by pier77 » Thu Aug 01, 2019 2:22 pm

Hi pmiklashevich,

the script does not override the class "Sch.mixin.AbstractTimelineView" have you a suggestion?

Thanks

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Incorrect startDate and endDate between drag and drop

Post by pmiklashevich » Thu Aug 01, 2019 2:32 pm

Please make sure your override is called. I mean that your override has to be required by a class which is used in your application. More about overrides and defining classes you can find here: https://docs.sencha.com/extjs/6.7.0/classic/Ext.html#method-define

Instead of creating anonymous override, you can name it as a class and require to your app

Code: Select all

Ext.define('AbstractTimelineViewOverride', {
    override            : 'Sch.mixin.AbstractTimelineView',
    getFormattedEndDate : function (endDate, startDate) {
        return this.getFormattedDate(endDate);
    }
});

Code: Select all

Ext.define('MyApp', {
    requires : [
        'AbstractTimelineViewOverride'
    ],
Pavel Miklashevich - Core Developer

Post Reply