Support

Home Forums Event Espresso Premium Event-date/time: Problem with localized am/pm-formats and date-picker-dialog

Event-date/time: Problem with localized am/pm-formats and date-picker-dialog

Posted: October 24, 2018 at 1:05 am


speedpartner

October 24, 2018 at 1:05 am

For events EE4 defaults to 12hour-format with am/pm. For a customer with a localized (German) WordPress this caused problems since the date-picker would write “nachm.” (“nachmittags” = German for “afternoon”) into the field, which the system would not understand and default to “am”.

Since our customer also would prefer 24-hours-format anyway we switched from 12h to 24h by the help of this workaround:
https://eventespresso.com/topic/localisation-of-datepicker-in-ee4/#post-171758

But could you maybe please:
* make sure the date-picker writes a format that EE4 then knows how to handle? And if it’s am/pm always (no localized version)
* add a switch to the configuration for 12h/24h-format

Maybe you could even work with the date/time-format that WordPress has in its settings? There 24-hours-format was already selected.

Sidenote, in that context: Germans are more used to 24.10.2018 instead of the reverse notation 2018-10-24. Maybe that could be another option to add. But it’s less critical than being able to have a working time-picker.


Josh

  • Support Staff

October 24, 2018 at 12:23 pm

Hi,

Thanks for making these suggestions. Last I checked there were some limits to using whatever was set in WP > Settings General, so they can’t use those settings for the datetime & ticket editors.

One thing you can do is set that your custom callback on the
FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings filter to use your preferred date format. e.g change the code to:

function ee_new_dtt_formats( $formats ) {
  return array(
    'date' => 'Y.m.d',
    'time' => 'H:i'
    );
}
add_filter( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', 
'ee_new_dtt_formats' 
);


speedpartner

October 26, 2018 at 6:37 am

Thanks. Modifying the behaviour through hooks works for us for the moment. But please consider turning that into a configuration-option, at least to switch between 12h/24h-mode. And maybe look into why the picker uses a localised version while after selecting a time the configuration-field can only deal with am/pm it seems.


Josh

  • Support Staff

October 29, 2018 at 7:32 am

The picker using a localized version on your site might be a plugin conflict. If I understand what you’re reporting, it shouldn’t be adding an AM/PM under any circumstances.

The support post ‘Event-date/time: Problem with localized am/pm-formats and date-picker-dialog’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso