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.

Share a Reply or Comment

Do NOT follow this link or you will be banned from the site!