Our state of the art Gantt chart


Post by peter4ef »

Hello,

We use several custom presets where we show the weeknumbers. Most of our customer prefer weeknumbers over dates. According to your documentation if we use dateFormat: "WW" this should show the ISO weeknumbers. However around the end of 2025, start of 2026 this is not the case.

I reproduced this in an example project, React-vite advanced in v6.1.6 of the Gantt. I added the following code to GanttProps:

  presets:[
        {
            id: "weekDateAndMonth",
            name: "Weeks 3",
            rowHeight: 24,
            tickWidth: 30,
            tickHeight: 40,
            displayDateFormat: "ll",
            shiftUnit: "week",
            shiftIncrement: 1,
            defaultSpan: 10,
            timeResolution: {
            unit: "day",
            increment: 1,
            },
            headers: [
            {
                increment: 1,
                unit: "month",
                dateFormat: "YYYY MMMM",
            },
            {
                increment: 1,
                unit: "week",
                dateFormat: "WW",
            },
            ],
            mainHeaderLevel: 1,
            columnLinesFor: 1,
        },
    ],
    viewPreset: "weekDateAndMonth",

This sets the viewpreset to one that shows weeknumbers. If I then navigate to the end of 2025, I see a week 53.

Screenshot 2025-05-13 115301.png
Screenshot 2025-05-13 115301.png (7.59 KiB) Viewed 131 times

However according to the ISO system(and also for example Outlook), it should go from week 52 to week 1. According to the ISO rule the year of the weeknumber is based on which year thursday falls in. So with thursday being on 1st January 2026, this is week 1. https://en.wikipedia.org/wiki/ISO_week_date

Which should result in:

Screenshot 2025-05-13 115831.png
Screenshot 2025-05-13 115831.png (13 KiB) Viewed 131 times

So I think this is a bug. Is there an easy way to implement a custom render function to correct this?


Post by alex.l »

Hi,

Thanks for the report, I've opened a ticket here https://github.com/bryntum/support/issues/11334
I don't see any easy way to patch it, unfortunately.
You can subscribe on ticket updates to be notified when it's done.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by Animal »

If you use a locale with week starting on the ISO standard week start day of Monday, as opposed to the default en-US locale, you would see the week numbering you prefer.

All other locales than the US English one use Monday.


Post by peter4ef »

This has nothing to do with the start of the week, we have a setting for that, but it still shows the wrong weeknumber:

Screenshot 2025-05-13 132228.png
Screenshot 2025-05-13 132228.png (4.99 KiB) Viewed 122 times

Also according to the docs, dateformat "WW" should use the ISO weeknumber regardless of locale.

However, I found that the header has a render function, so I am working on something like this to fix it:

headers: [
            {
                increment: 1,
                unit: "month",
                dateFormat: "YYYY MMMM",
            },
            {
                increment: 1,
                unit: "week",
                dateFormat: "WW",
                renderer : function(startDate: any, endDate: any, headerConfig: any, i: any) {
                    console.log("renderer");
                    let weekNumber = getIsoWeekNumber();
                    return weekNumber.toString();
                },
            },
            ],

Post by Animal »

The week number is calculated using the week start day. If you are in Europe and use Monday, then if you use a correct locale, it will end up with the week number you expect.


Post by peter4ef »

That is simply not true. I am in Europe, I use monday as the start of the week, and it still calculates week 53. This is reproducable in the example mentioned above.


Post by peter4ef »

Included a runnable example to prevent miscommunication:

  • unzip
  • npm install
  • npm run start
  • > weeks start at monday, week 53 in 2025.
Attachments
advanced.zip
(4.27 MiB) Downloaded 7 times

Post by Animal »

See this Codepen which uses the latest Gantt to show the 2025->2026 year boundary using your ViewPreset: https://codepen.io/Animal-Nige/pen/MYYZLdO?editors=0010


Post by johan.isaksson »

Hi ,

This issue was fixed in v6.2.1, I see that your example uses an older version (this ticket https://github.com/bryntum/support/issues/10991).

Have you tried upgrading and can you confirm that it then works as expected? If so, I'll close the new ticket (https://github.com/bryntum/support/issues/11334)

Best regards,
Johan Isaksson

Post Reply