Our powerful JS Calendar component


Post by jbyvik »

Heyo!
Rrule generation seems broken in 4.2.4 not generating a event for the first sunday in the chain.

testing in https://bryntum.com/examples/calendar/basic/

Im creating the following event:
Image

and its not managing to generate a task for the firstSunday of the chain, resulting in this in the agenda view:
Image

and this in the calendar month view
Image


Post by alex.l »

Hi jbyvik,

Sunday is the first day of the week, your rule starts after the Sunday of the current week, so the next 3 weeks will be skipped because of "every 3 weeks" config in your rule.

All the best,
Alex


Post by jbyvik »

Seems to not matter, im setting weekStartDay: 1, in the demo above which works fine but still generates the events incorrectly (this time not hitting the sunday that is ^^. Ontop of that it seems to loose the setting when I navigate (assume its shift() functions) backwards / forward.

Image


Post by arcady »


Post by jbyvik »

Realised I put this issue on hold, but this is still a major issue with the rRule generation :)

So in the basic calendarExample im setting this as config where the only diff is weekStartDay :1, making monday first day of the week:

import { Calendar } from '../../build/calendar.module.js?453898';
import shared from '../_shared/shared.module.js?453898';

const calendar = new Calendar({
    // Start life looking at this date
    date : new Date(2020, 9, 12),

// CrudManager arranges loading and syncing of data in JSON form from/to a web service
crudManager : {
    transport : {
        load : {
            url : 'data/data.json'
        }
    },
    autoLoad : true
},

appendTo : 'container',
weekStartDay: 1,

// Features named by the properties are included.
// An object is used to configure the feature.
features : {
    eventTooltip : {
        // Configuration options are passed on to the tooltip instance
        // We want the tooltip's left edge aligned to the right edge of the event if possible.
        align : 'l-r'
    }
}
});

I then create a new event that SHOULD generate this rRule:
FREQ=WEEKLY;COUNT=30;INTERVAL=2;BYDAY=TU,TH,SU

but the settings in the UI is this:
Image

So the issue should be regarding WKST=MO. THe RFC 5545 standard sais this regarding WKST:

The WKST rule part specifies the day on which the workweek starts.
Valid values are MO, TU, WE, TH, FR, SA, and SU. This is

Desruisseaux Standards Track [Page 42]

RFC 5545 iCalendar September 2009

  significant when a WEEKLY "RRULE" has an interval greater than 1,
  and a BYDAY rule part is specified.  This is also significant when
  in a YEARLY "RRULE" when a BYWEEKNO rule part is specified.  [b][i]The
  default value is MO.[/i][/b][/quote]

link: https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10 as shown in your docs :)

so how do you handle WKST? Do you override it with the calendars weekStartDay setting? BEcuase I asusme when I set weekStartDay: 1, it should be monday and this not change the rRule generation.

When I try localy and hardOVerride the rRUle and manually set WKST=MO it has no difference.

The rRule skips the upcoming sunday as shown in this screenshot :) rouding off the error description

Image

The error here is that the sunday 29th task should be on the 22nd etc.


Post by jbyvik »

Realised I put this issue on hold, but this is still a major issue with the rRule generation :)

So in the basic calendarExample im setting this as config where the only diff is weekStartDay :1, making monday first day of the week:

import { Calendar } from '../../build/calendar.module.js?453898';
import shared from '../_shared/shared.module.js?453898';

const calendar = new Calendar({
    // Start life looking at this date
    date : new Date(2020, 9, 12),

// CrudManager arranges loading and syncing of data in JSON form from/to a web service
crudManager : {
    transport : {
        load : {
            url : 'data/data.json'
        }
    },
    autoLoad : true
},

appendTo : 'container',
weekStartDay: 1,

// Features named by the properties are included.
// An object is used to configure the feature.
features : {
    eventTooltip : {
        // Configuration options are passed on to the tooltip instance
        // We want the tooltip's left edge aligned to the right edge of the event if possible.
        align : 'l-r'
    }
}
});

I then create a new event that SHOULD generate this rRule:
FREQ=WEEKLY;COUNT=30;INTERVAL=2;BYDAY=TU,TH,SU

but the settings in the UI is this:
Image

So the issue should be regarding WKST=MO. THe RFC 5545 standard sais this regarding WKST:

The WKST rule part specifies the day on which the workweek starts.
Valid values are MO, TU, WE, TH, FR, SA, and SU. This is significant when a WEEKLY "RRULE" has an interval greater than 1, and a BYDAY rule part is specified. This is also significant when in a YEARLY "RRULE" when a BYWEEKNO rule part is specified. The default value is MO.

link: https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10 as shown in your docs :)

so how do you handle WKST? Do you override it with the calendars weekStartDay setting? BEcuase I asusme when I set weekStartDay: 1, it should be monday and this not change the rRule generation.

When I try locally and hardOverride the rRUle and manually set WKST=MO it has no effect.
(Sending this to the calendar: FREQ=WEEKLY;COUNT=30;INTERVAL=2;BYDAY=TU,TH,SU;WKST=MO

The rRule skips the upcoming sunday as shown in this screenshot :) rouding off the error description

Image

The error here is that the sunday 29th task should be on the 22nd etc.


Post by Animal »

There is an issue that the DateHelper class which performs date manipulations always uses the locale-defined week start day.

That defined in the Calendar is not taken into account. We have a ticket outstanding to fix this.

https://github.com/bryntum/support/issues/2850


Post by Animal »

In fact, you could set the value in the DateHelper class like this:

// Tell dateHelper to use Monday as its week start, regardless of what the locale says.
// This will now be used globally by all date calculations in the app.
Object.defineProperty(DateHelper, 'weekStartDay', { get() { return 1; }});

But the real fix is to use locales. By default the EN locale specifies week start day 0 (Sunday)

Other locales use 1 (Monday)

You could use one of the other locales, or edit the EN locale file to

        DateHelper : {
            locale         : 'en-US',
            weekStartDay   : 0,
...

Post by jbyvik »

Yeh so setting the weekStartDay via DateHelper class works and It overrides whatever locale I had. But the recurranceRule still generates date incorrectly. Where the sunday in the workweek gets skipped in favor of the default weekDay (meaning the sunday week before the weekday, see screenshot of the rRule shown above)

Image


Post by arcady »

Reproduced and will be fixed soon.
Here is a ticket to track the bug state: https://github.com/bryntum/support/issues/3593
Thank you for the report!


Post Reply