0

I'm getting a problem with the entry_date field when creating an entry via a channel form.

I have set the following parameters on the channel form:

  include_jquery="no"
  include_assets="no"
  datepicker="no"

and I am initializing the date picker field myself as I want to set the date format and date range myself:

        //init our datepicker setting date range
    $date.datepicker({ minDate: -90, maxDate: "+0D"});

    //set our date format based on locale
    var locale = navigator.language || navigator.userLanguage; 
    if (locale === "en-US") {
            var dateformat = 'mm/dd/yyyy';
        } 
        else {
            var dateformat = 'dd/mm/yyyy';
        }
        $date.datepicker({dateFormat: dateformat});

After submitting the form When I look in the database (exp_channel_titles) it has the correct values for the year, month and day columns but the entry_date column is saving a timestamp that is always a day behind.

If I change the channel form to use the native EE implementation of the date picker, i.e set my parameters to :

  include_jquery="no"

thereby having EE initialize the date picker field then the date is saved correctly but this way I am unable to set the date format or date range.

Any suggestions?

2
  • This likely isn't your specific issue, but you should always submit dates in the same format as your EE date format setting - especially when using ambiguous date formats as you do above. Otherwise EE has no idea what you mean when you submit a date for any date of the month before the 13th (because the first two date segments could reasonably be assumed to be month or day). Commented Jun 16, 2016 at 12:13
  • That thought occurred to be last night too. The thing is our site is accessed globally, so I don't want to tie users in to a US date format which could be very confusing for non US users. Other than handling a conversion during form submission can you think of any way to let EE know the format before hand?
    – KoalaKid
    Commented Jun 16, 2016 at 17:43

1 Answer 1

0

OK, I found the issue, unlikely that someone else will run into it but you never know.

So we migrated our site from 2.7.2 > 2.10.2. During the migration I did a straight copy of the entire exp_member table. However the column structure of this table has diverged across the new versions. My table was missing two columns relating to localization settings (date format & hours). Adding these back in fixed my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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