search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Year View (version 2024.3.6130)

Asked by Kym Phillips
2 months ago.

Using Year View; Event added into first day of month also shows in last day +1 of previous month on some occasions. EG event: 29 Feb 2024 is OK, event:1 Mar 2024 shows as 30 Feb 2024 AND 1 Mar 2024.

Using sample code with an event generator:

// Generate daily event accumulators
var DateGen = new DayPilot.Date.parse("2024-01-01", "yyyy-MM-dd");
var DateMax = new DayPilot.Date.parse("2025-01-01", "yyyy-MM-dd");

while (DateGen < DateMax) {
    if ([1, 2, 3, 4, 5].includes(DateGen.dayOfWeek())) { // Check if it's a weekday
        var e = {
            start: DateGen.addHours(7),
            end: DateGen.addHours(15),
            text: ""
        };

        console.log(e, DateGen.dayOfWeek());

        events.push({
            ...e,
            ...{
                id: DayPilot.guid(),
                backColor: "rgba(162,41,40,0.50)"
            }
        });

        events.push({
            ...e,
            ...{
                id: DayPilot.guid(),
                backColor: "rgba(162,41,40,0.40)"
            }
        });
    }

    DateGen = DateGen.addDays(1);
}

dp.update({
    resources,
    events,
    startDate
});
Answer posted by Dan Letecky [DayPilot]
2 months ago.

Hi Kym,

Sorry for the delay!

This issue is now fixed in the latest sandbox build (2024.3.6136).

With this build, you can specify the end for each row/month, and it will disable the subsequent cells:

// ...
for (let i = 0; i < 12; i++) {
    const month = startDate.addMonths(i);
    resources.push({
        name: month.toString("MMMM"),
        start: month,
        end: month.addMonths(1),
    });
}
// ...

You can see the sandbox yearly Scheduler example online.

This build also prevents drag-and-drop actions for the invalid day slots at the end of short months.

The year view still doesn’t support a target shadow that spans multiple rows (when dragging over the end of a month), but that feature is coming soon.

Comment posted by Kym Phillips
2 months ago.

Tested OK and working as expected on 2024.3.6138.

Thank you Dan.

Comment posted by Dan Letecky [DayPilot]
2 months ago.

Great, thanks for the update!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.