Date Picker Range

Date Picker Range

TomBajzekTomBajzek Posts: 164Questions: 37Answers: 1

The range of selectable dates appears to end with 2028. I have a need to enter dates later than that. Is there a way to extend the range of choosable dates?

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 3,021Questions: 88Answers: 421

    Pls take a look:

    }, {
        label: lang === 'de' ? 'Tatsächliches Enddatum:' : 'Actual End Date:',
        name:  "contract.exp_date",
        attr: {
            class: dateMask
        },
        type:  "datetime",
        format: 'L',
        opts:  {
            showWeekNumber: true,
            yearRange: 40,
            momentLocale: momentLocale
        }
    

    yearRange is what you are looking for. I guess the default is 10.

  • TomBajzekTomBajzek Posts: 164Questions: 37Answers: 1

    In what file is the code in your example? Is it embedded in one of the files in the DataTables library?

    Thanks,
    Tom

  • kthorngrenkthorngren Posts: 21,448Questions: 26Answers: 4,974
    Answer ✓

    Its an Editor Filed config option:
    https://editor.datatables.net/reference/field/datetime

    Kevin

  • TomBajzekTomBajzek Posts: 164Questions: 37Answers: 1

    Kevin,

    Thanks for the pointer. It does what I wanted. I might comment that it extends the dateRange in both directions, which can be useful to know as well.

    Thanks!

  • kthorngrenkthorngren Posts: 21,448Questions: 26Answers: 4,974

    Glad you got it worked out and thanks for letting us know it goes in both directions. rf1234 is the one who actually provided the answer. I just gave you the link to the docs.

    Kevin

  • rf1234rf1234 Posts: 3,021Questions: 88Answers: 421

    Never mind, Kevin! This is team work, isn't it? What I really like about this forum is that it is so civilized and people are usually nice to each other.
    @ Tom, glad you got it working and thanks for the hint about both directions. Wasn't aware of that.

    Roland

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    I love this forum for the input that you guys all give. Endless thank yous from me!

    Yes, the default for the date range is 10 years so that the select list isn't massive by default. You can also it as Kevin and Roland have described. There is also the minDate option that can be used if you don't want it extending into the past.

    Allan

This discussion has been closed.