Datetime def not working?

Datetime def not working?

bfarkasbfarkas Posts: 120Questions: 31Answers: 0

Is the datetime field not accepting the def input anymore, trying it a few ways and even with just copying from the example, it either errors, or I have to quote it out and then it just shows up as text in that field.
Trying to set the default for a date to be today-18 years so was aiming for something along moment().subtract(18, 'years')
but as I said even the function () { return new Date(); } doesn't seem to work. I went to the manual page on the inoput and don't see a def defined either.

Answers

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    It's working in this example here - that's the last release. If that doesn't help, could you link to your page, please, or update this example here to demonstrate the issue,

    Colin

  • bfarkasbfarkas Posts: 120Questions: 31Answers: 0

    Hmm, it does work in both places for me, just not in mine, so something is definitely up there.
    https://newyorklife.acms.com/pti62nkppw16/

    Here is a quick upload of it. Thoughts? The end goal is to get it set to be 18 years old from the current date.
    Thanks!

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    I took a look at the page - it's not loading due an error ("Uncaught SyntaxError: Unexpected token 'function'"), and it looks like the source is minimised so I can't read it. Could you take a look, please,

    Colin

  • bfarkasbfarkas Posts: 120Questions: 31Answers: 0

    Sorry about that, although that is similar to the error that is thrown when you go to click new when I try the def for datetime.
    I just updated and took a look and the page completes load now:
    https://newyorklife.acms.com/pti62nkppw16/

  • bfarkasbfarkas Posts: 120Questions: 31Answers: 0

    This got stranger today, the calendar does not display years previous to 2010...

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    I took another look. The table is empty, and pressing New gives an error. The code still looks minimised, so I can't debug. Could you unminimise it, please.

    The range of dates is set by opts.yearRange in datetime, the default is 10,

    Colin

  • bfarkasbfarkas Posts: 120Questions: 31Answers: 0

    Thanks for the year range will give that a try.
    The error is created from adding the date time def. when I remove it the table works as expected.

  • bfarkasbfarkas Posts: 120Questions: 31Answers: 0

    I pulled the main HMTL and javascript configuration page and posted here:
    http://live.datatables.net/nolefuqe/1/edit

  • colincolin Posts: 9,806Questions: 0Answers: 1,623

    We would really need to see the def failing. That code you posted doesn't run, and you have

                    "def":       function () { return new Date(); },
    

    which is the same as in the example that I posted before that works.

    Could you unminimise the code on your site, like I've asked before, as that would help us debug what you've got.

    Colin

Sign In or Register to comment.