Premium support for our pure JavaScript UI components


Post by jk@datapult.dk »

Howdy,

I Denmark - just like in Sweden - weeks start Mondays. If you copy/paste this code into the basic example (https://bryntum.com/products/scheduler/examples/basic/) week starts Sundays.

See the attached screenshot.

Screenshot 2022-12-08 at 20.35.58.png
Screenshot 2022-12-08 at 20.35.58.png (71.21 KiB) Viewed 1148 times

Have I misconfigured something or?

import { Scheduler, LocaleManager } from '../../build/scheduler.module.js?463787';
import shared from '../_shared/shared.module.js?463787';

//region Data

LocaleManager.registerLocale('En', {
    desc: 'En',
    locale: {
        DateHelper: {
            locale: "da-DK",
        }
    }
})


//endregion

const scheduler = new Scheduler({
    appendTo         : 'container',
    resources        : [],
    events           : [],
    startDate        : new Date(2017, 0, 1, 6),
    endDate          : new Date(2017, 2, 1, 20),
    viewPreset       : 'example',
    presets: [{
        id: "example",
        name: "example",
        defaultSpan: 7 * 4,
        timeResolution: {
            unit: "day",
            increment: 1,
        },
        headers: [
            {unit: "week", dateFormat: "W",},
            {unit: "month", dateFormat: "MMMM",},
            {unit: "day", dateFormat: "D",},
            {unit: "day", dateFormat: "ddd",},
        ],
    }
    ],
    rowHeight        : 50,
    barMargin        : 5,
    multiEventSelect : true,
    columns          : [
        { text : 'Name', field : 'name', width : 130 }
    ]
});

Post by tasnim »

Hi,
I tried to change the timeAxis. but seems like it's a bug not changing. So I've created a ticket for that, here it is https://github.com/bryntum/support/issues/5741

Good Luck :),
Tasnim


Post by arcady »

You need to provide https://www.bryntum.com/products/gantt/docs/api/Core/helper/DateHelper#property-weekStartDay-static in your locale.
Your code starts working after doing that:

LocaleManager.registerLocale('En', {
    desc: 'En',
    locale: {
        DateHelper: {
            locale: "da-DK",
            // week starts on Monday
            weekStartDay : 1
        }
    }
})

Post Reply