Developers Corner: Datetime System improvements coming with (tentatively) EE 4.8

Hey folks, there are some significant improvements coming to the EE4 date and time system with Event Espresso 4.

Note, these improvements will impact any custom code and/or third party add-ons that utilize the Event Espresso Datetime system.  So developers will want to take note of them and prepare your code for these changes as soon as possible.

Summary of Changes

As we improve systems in Event Espresso 4, our goal is to make them simple, clear, and as flexible as possible; these datetime improvements do just that. Here’s a summary of these improvements, but please see the Important Changes to EE_Datetime System coming to EE article on the Developer Portal for complete details:

1. Dates continue to be saved in the database in mysql format (Y-m-d H:i:s) and UTC+0.  Nothing changes there.

2. Dates live within the models and model objects as PHP DateTime objects.

3. Any unixtimestamps coming into the EE Date Time system are considered to be a true unixtimestamp (time()) and not a timestamp with the calculated offset that current_time('timestamp') provides.

4. Formats are now required for when instantiating EE_Base_Class objects with date time strings that are not a unixtimestamp.

5. New helpers are available for setting up strings for date related queries.

6. New EE_Base_Class helper for displaying localized date.

7. Extensive unit test coverage

When will these improvements be released?

Right now all the changes are found in the FET-3456-promotions-spco branch of Event Espresso 4.  This branch is currently available on our Pre-release Channel (prc) (sign up via your account page) for those who wish to try it out.  We strongly encourage developers to checkout the branch via github and make sure any of your custom code and/or custom add-ons work with the new improvements.

For existing Event Espresso 4 users, we have already updated all our core add-ons that are impacted by these improvements so they work both with the current datetime system and the new datetime system.  So you should see no impact when we release this on the stable channel.

Have any questions or feedback? You can leave a comment below, post in the forums, or even create an issue in Github.

Related Articles

Share a Reply or Comment

Your email address will not be published. Required fields are marked *

Need help with Event Espresso? Create a support post in our support forums

Do NOT follow this link or you will be banned from the site!
[gravityform id=116 title=false description=false]
<div class='gf_browser_unknown gform_wrapper' id='gform_wrapper_116' ><form method='post' enctype='multipart/form-data' id='gform_116' action='/2015/06/developers-corner-datetime-system-improvements-coming-with-tentatively-ee-4-8/'> <div class='gform_body'><ul id='gform_fields_116' class='gform_fields top_label form_sublabel_below description_below'><li id='field_116_5' class='gfield gfield_contains_required field_sublabel_hidden_label field_description_below gfield_visibility_visible' ><label class='gfield_label gfield_label_before_complex' >What is your first name?<span class='gfield_required'>*</span></label><div class='ginput_complex ginput_container no_prefix has_first_name no_middle_name no_last_name no_suffix gf_name_has_1 ginput_container_name' id='input_116_5'> <span id='input_116_5_3_container' class='name_first' > <input type='text' name='input_5.3' id='input_116_5_3' value='' aria-label='First name' aria-required="true" aria-invalid="false" placeholder='First name'/> <label for='input_116_5_3' class='hidden_sub_label screen-reader-text'>First name</label> </span> </div></li><li id='field_116_1' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_116_1' >What is your email address so we can follow up with you?<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_text'><input name='input_1' id='input_116_1' type='text' value='' class='medium' placeholder='hello@example.com' aria-required="true" aria-invalid="false" /></div></li><li id='field_116_2' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_116_2' >Tell us about your concerns below<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_textarea'><textarea name='input_2' id='input_116_2' class='textarea medium' placeholder='What kind of events are you planning?' aria-required="true" aria-invalid="false" rows='10' cols='50'></textarea></div></li><li id='field_116_6' class='gfield field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' >GDPR Agreement</label><div class='ginput_container ginput_container_checkbox'><ul class='gfield_checkbox' id='input_116_6'><li class='gchoice_116_6_1'> <input name='input_6.1' type='checkbox' value='I consent to have this website store my submitted information so they can respond to my inquiry.' id='choice_116_6_1' /> <label for='choice_116_6_1' id='label_116_6_1'>I consent to have this website store my submitted information so they can respond to my inquiry.</label> </li></ul></div></li><li id='field_116_3' class='gfield gform_hidden field_sublabel_below field_description_below gfield_visibility_visible' ><input name='input_3' id='input_116_3' type='hidden' class='gform_hidden' aria-invalid="false" value='' /></li><li id='field_116_4' class='gfield gform_hidden field_sublabel_below field_description_below gfield_visibility_visible' ><input name='input_4' id='input_116_4' type='hidden' class='gform_hidden' aria-invalid="false" value='https://eventespresso.com/2015/06/developers-corner-datetime-system-improvements-coming-with-tentatively-ee-4-8/' /></li><li id='field_116_7' class='gfield gform_validation_container field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_116_7' >Comments</label><div class='ginput_container'><input name='input_7' id='input_116_7' type='text' value='' autocomplete='off'/></div><div class='gfield_description' id='gfield_description__7'>This field is for validation purposes and should be left unchanged.</div></li> </ul></div> <div class='gform_footer top_label'> <input type='submit' id='gform_submit_button_116' class='gform_button button' value='Send my message' onclick='if(window["gf_submitting_116"]){return false;} if( !jQuery("#gform_116")[0].checkValidity || jQuery("#gform_116")[0].checkValidity()){window["gf_submitting_116"]=true;} ' onkeypress='if( event.keyCode == 13 ){ if(window["gf_submitting_116"]){return false;} if( !jQuery("#gform_116")[0].checkValidity || jQuery("#gform_116")[0].checkValidity()){window["gf_submitting_116"]=true;} jQuery("#gform_116").trigger("submit",[true]); }' /> <input type='hidden' class='gform_hidden' name='is_submit_116' value='1' /> <input type='hidden' class='gform_hidden' name='gform_submit' value='116' /> <input type='hidden' class='gform_hidden' name='gform_unique_id' value='' /> <input type='hidden' class='gform_hidden' name='state_116' value='WyJbXSIsIjBiNjdjZjkyMDUzOWUxOWY5Y2NiZjIwMzM4YjA1Mjk4Il0=' /> <input type='hidden' class='gform_hidden' name='gform_target_page_number_116' id='gform_target_page_number_116' value='0' /> <input type='hidden' class='gform_hidden' name='gform_source_page_number_116' id='gform_source_page_number_116' value='1' /> <input type='hidden' name='gform_field_values' value='' /> </div> </form> </div><script type='text/javascript'> jQuery(document).bind('gform_post_render', function(event, formId, currentPage){if(formId == 116) {if(typeof Placeholders != 'undefined'){ Placeholders.enable(); }} } );jQuery(document).bind('gform_post_conditional_logic', function(event, formId, fields, isInit){} );</script><script type='text/javascript'> jQuery(document).ready(function(){jQuery(document).trigger('gform_post_render', [116, 1]) } ); </script>