Date Picker Range

Date Picker Range

TomBajzekTomBajzek Posts: 163Questions: 36Answers: 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: 2,801Questions: 85Answers: 406

    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: 163Questions: 36Answers: 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: 20,144Questions: 26Answers: 4,736
    Answer ✓

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

    Kevin

  • TomBajzekTomBajzek Posts: 163Questions: 36Answers: 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: 20,144Questions: 26Answers: 4,736

    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: 2,801Questions: 85Answers: 406

    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: 61,446Questions: 1Answers: 10,054 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.