2

I'm building a page with the twitter bootstrap at the moment and in particular am using the bootstrap datepicker to give users a particularly nice UI for selecting an entry date for their channel entry.

However, SafeCracker keeps telling me that the format of the date is incorrect - What dateformat should I be supplying? I've tried DD/MM/YY, MM/DD/YY, YYYY-MM-DD and none of them work. Do I need to supply a time as well?

I don't want to have to supply a time, since it's irrelevant for this purpose - but even putting into the formatting a default time (so using format dd/mm/yy 00:00), but this doesn't work either).

Anyone offer an insight?

4

EE requires the date format yyyy-mm-dd hh:mm AM/PM for the Entry Date. I know with jQuery's date picker you can make the submitted format different from the displayed format, but it doesn't look like the Bootstrap date picker has that option.

One option would be to use an EEvent Helper date field, which omits the time requirement, and then set it to auto-populate the Entry Date in the EEvent Helper settings.

| improve this answer | |
3

Safecracker actually wants it like this:

YYYY-MM-DD 00:00 AM

Example: 2013-01-04 01:31 PM

| improve this answer | |
  • if you set EE to european notation (admin, localisation, time formatting) you can skip the AM/PM part (and insert times from 00:00 - 23:59) – GDmac Jan 24 '13 at 14:37
0

I also ran into this issue and had a few things to get over.

  1. You must disable the datepicker in the SafeCracker parameters before you can override the javascript settings.

    {exp:safecracker channel="jobs" datepicker="no"}

  2. I chose to add the time myself to the date format as I didn't nto want to add an additional plugin to set the time and it is semi irrelevant to my date.

    $(".datepicker").datepicker({ dateFormat: "yy-mm-dd 12:00 'PM'",
    maxDate: "+0d", changeMonth: true, changeYear: true, altFormat: "DD, d MM, yy" });

  3. The other alternative is to use a separate field to display your data differently from the submitted data by using the additional field option and submitting in in a hidden field. Check out the datepicker widget API for the examples http://api.jqueryui.com/1.8/datepicker/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.