DateTime picker not working in month/day/year 12h format

DateTime picker not working in month/day/year 12h format

ironandsteelironandsteel Posts: 17Questions: 4Answers: 0

I have been unable to get a datetime picker to work.

One way to repro the problem is this:
1. Go to the generator and create a project with a datetime field
2. for the format, pick Month/Day/Year 12h (this is the format that I want)
3. Click run now to run the project
4. Click New to make a new entry.
5. The datepicker shows up (no time picker)
6. Click on a date, and click "Create"
7. You get a validation error (field turns red)

In the js, the code for that field look like this:

var editor = new $.fn.dataTable.Editor( { ajax: 'php/table.project.php', table: '#project', fields: [ { "label": "biddue_dt:", "name": "biddue_dt", "type": "datetime", "format": "YYYY-MM-DD" } ] } );

Clearly, the "format": "YYYY-MM-DD" is wrong. So this looks like a bug in the generator.

However, if I use this for the format, it does work:
"format": "DD\/MM\/YY HH:mm"

Ok, so now I should be able to modify the format like I want it:
"format": "MM\/DD\/YYYY hh:mm"

This indeed shows the picker in the right format, but like the first example, the create button fails with red outline and "Data is not in expected format".

BTW in the generator, I asked it to include the moment library, and I'm using datatables styling.
Same thing happens in Chrome and Firefox and Edge

Replies

  • ironandsteelironandsteel Posts: 17Questions: 4Answers: 0

    I have a test case for the non-functional "format": "MM\/DD\/YYYY hh:mm":

    here

  • allanallan Posts: 43,557Questions: 1Answers: 5,703 Site admin

    Sorry about that! Thanks for letting me know.

    I've just corrected the issue in Generator now. If you create a new package with the date time format you want it should work correctly now!

    Allan

  • ironandsteelironandsteel Posts: 17Questions: 4Answers: 0

    Excellent! Thanks for taking care of this. Now- one more thing: In the generator, select JQuery UI for the styling and run it. You'll see that there is no "New" button. The other 3 styling choices work fine.

    Thanks!

  • allanallan Posts: 43,557Questions: 1Answers: 5,703 Site admin

    Doh! Thanks :smile:.

    Also now fixed!

    Allan

  • ironandsteelironandsteel Posts: 17Questions: 4Answers: 0

    Yay! Thanks for the quick response, Allan! I love datatables and the editor. Great work!

Sign In or Register to comment.