Problem setting firstDay

Problem setting firstDay

milapmilap Posts: 40Questions: 13Answers: 2
edited July 2021 in DateTime

Hello,
I have a problem while setting first day of the week (should be monday).
It is not working.

I am fallowing your doc:
https://datatables.net/extensions/datetime/option/firstDay
...but there is no change: first day of the week stays sunday

My code is:

$(document).ready(function() {
    var editor = new $.fn.dataTable.Editor( {
        ajax: 'php/table.test.php',
        table: '#test',
        fields: [ {
            "label": "Lp:",
            "name": "sort",
            "type" : "hidden",
            "fieldInfo": "This field can only be edited via click and drag row reordering."
            },
            {
                "label": "Txt #1:",
                "name": "txt_1"
            },
            {
                "label": "Txt #2:",
                "name": "txt_2"
            },
            {
                "label": "Auto-activation",
                "name": "activation_time",
                "type": "datetime",
                "format": "YYYY-MM-DD HH:mm",
                "firstDay": 1
            },
(...)

I am also trying a method to add code below after $(document).ready(function() { ... }

new DateTime(document.getElementById('activation_time'), {
    firstDay: 1
});

But it does nothing.

Other settings like for instance format or translating via i18n are working fine...
What am I doing wrong?

I am using editor v 2.0.4 and datepicker plugin from generator

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,177Questions: 1Answers: 2,590
    Answer ✓

    As it's an option, it needs to go into an opts object, see example here.

    Colin

  • milapmilap Posts: 40Questions: 13Answers: 2

    Thanks for help!

Sign In or Register to comment.