Support

Account

Home Forums ACF PRO Date/Time picker in 5.3.9 causes trouble…

Solved

Date/Time picker in 5.3.9 causes trouble…

  • Got some serious issues since the update to 5.3.9 and 5.3.9.1.

    Since I’ve used the “Date and Time Picker Field” from Per Soderlind, I do have errors and my site won’t load.

    Error reads something like

    Fatal error: Cannot redeclare class acf_field_date_time_picker in /home/httpd/vhosts/domainname.tdl/httpdocs/wp-content/plugins/acf-field-date-time-picker/date_time_picker-v5.php on line 0

  • I got the same problem. I had to upload an old version of ACF Pro to a lot of clients websites. This also breaks the functionality, even after I disabled the acf-field-date-time-picker plugin.

    The new function should be implemented using a different function name since it’s not working in the same way, allowing both date/time-pickers to be enabled.

  • I had the same issue, but it was because I was using a 3rd party plugin for the date and time picker from here

    Once I removed the 3rd party plugin, it resolved the issue, but I did have to resave posts with the date and time picker fields.

  • Hi guys

    Thanks for the reply.

    Yes, the 3rd party add-on has used a class name matching ACF’s internal naming convention. This has led to the conflict.

    Furthermore, where ACF wraps it’s classes in an if statement to avoid duplicate classes, this 3rd parry add-on has not. Because the 3rd party add-on is loaded after ACF, it causes the duplicate class issue.

    A simple if statement will fix the problem for now, and the values previously saved should load correctly through the new core date time picker field

  • I’ve written a lot of functionality based on the acf-field-date-time-picker plugin. Yesterday, I tried to update by first disabling third-party plugin, but it does not work. On this particular website, posts are deleted after a specific date and time. This just deleted 600+ posts and I had to restore from backup. The client wasn’t happy.

    On another website, I updated and tried to re-save the posts (26 different posts with opening times, vacations, special opening times etc). They all returned the current timestamp. Restore from backup once again.

    So, it’s just not a solution to remove the third party acf-field-date-time-picker and update acf pro. It breaks the previous functionality.

  • I am having the same issues as other people.

    Already had to put back 3 websites back-ups. The time is indeed not the same as the 3rd party addon in the database, everything gets broken when I update to your latests ACF PRO.

  • Hi guys

    Thanks for the feedback.

    For now, please comment out the inclusion of the ACF date time picker field.
    You can find this within the acf.php file ~ line 224

    Next, can you please both create a new support ticket (link below) with full description of the issue. Please be sure to look at your DB and understand how they were previously saved, this will help to make the transition between the 2 field types more seamless.

  • Hi guys

    I’ve just done some testing with the 3rd party field type (https://wordpress.org/plugins/acf-field-date-time-picker/) and have found some solutions.

    1. I have fixed the class name clash causing a whitescreen after activation
    2. I have added some extra logic to the date, date time, and time fields to work with previous ‘timestamp’ values.

    Now, your timestamp values should be readable by ACF.

    Can you please re-download the plugin from your online account and hard refresh your browser (when on the edit screen). Let me know if you have any success or failure with these fixes

    Thanks
    Elliot

  • I’ve tried with one of my development websites and I still have a problem with 24h time. It should display as 15:30, but it displays as 16 3:3. Isn’t there a way to just implement them side by side? So that I don’t need to modify the code on 30+ project that is using this third party datetime picker?

    I’ll create a new support ticket later tonight if I find the time.

  • Hi @markus

    Thanks for the reply.
    – Is the issue when entering a value, or when viewing the front end?
    – What are the display_format and return_format settings for the field?

  • Hi Elliot,

    Both on the front end and when entering a value.

    Date Format is yymmdd
    Time Format is HH:mm
    Save as timestamp? no
    Get field as timestamp? no

  • Hi @markus

    These are the settings for the 3rd party field type.
    What are the settings for the ACF field when you update ACF to 5.3.9.1 and deactivate the 3rd party plugin?

  • Yes, I know.

    After update to 5.3.9.1 the fields defaults back to this:

    Display format: 16/06/2016 10:00 am
    Return format: 16/06/2016 10:00 am

  • Hi @markus

    Have you tried changing the ‘return_format’ settings to better match those of the previous time picker field?

    24 hour time could be done with the string “H:i”
    http://php.net/manual/en/function.date.php

    So perhaps “d/m/Y H:i” would return the value as you expect it.

  • Elliot, just a question, why can’t you just save the date the same way the 3rd party one did?

  • Yes, I can change the return value and make it work.

    However, I’ve used the third party datetime-picker for a lot of functionality during recent years. Its not only for displaying a date and time on a website. Its for schedule import and export of business systems, apis, woocommerce integrations, integrations with booking systems, etc. All these projects will need to be re-tested.

    How about disable the new core functionality for datetime-picker if the third party datetime-picker exists?

  • For me it is solved by some tips given here. Was quite a shock when a third party plugin is mostly replaced by ACF itself and then breaks the sites. Had to get my hands on 4 different pages with different fields and settings.

  • Hi guys

    Thanks for your questions.

    This has indeed been an oversight on my behalf.
    I had not used the 3rd party add-on, and did not anticipate these UX issues.

    Please note that the 3rd party datetime picker saves it’s value as a unix timestamp.
    ACF PRO saves it’s value as a human friendly version YYYY-MM-DD H:i:s

    Both of these values are compatible with ACF’s method of loading the value and formatting it into any return_format.

    Please ensure you have downloaded the latest plugin files (I’ve made a few updates over night to allow compatibility with unix timestamps) and change your ‘return format’ to the desired format.

    Although frustrating, please try to see this transition as if a 3rd party developer made an app to view dropbox files. Then, dropbox themselves released their own app. The two do the same thing but are not intended to replace each-other or be compatible.

    Thanks
    E

  • Hi guys,

    I have created a polyfill for live sites using the 3rd party addon, that should allow updating ACF without breaking existing functionality and without requiring further action. It’s only meant as a temporary solution to be able to take the time needed to adjust the affected sites without compromising functionality in the meantime.

    I’ve just seen this thread now, so I’m not sure if you’ve been working more on the issue in the meantime Elliot?

    Check it out and read more here: https://github.com/andersthorborg/ACFDateTimePickerPolyfill

  • Hi @andersthorborg

    Great work!
    Yes, I’ve been improving the datetime picker and have so far fixed:
    – class name no longer conflicts
    – ACF field not loads value if saved as unix timestamp

    The last compatibility fix is to read in the previous field’s settings.
    They are slightly different but should be possible to load in (as your polyfill is doing!)

  • Great.

    I’m still not sure exactly how to handle loading the old date-format settings while still being able to change/save them. Perhaps the built in field could load the old data as default value until it is saved.

    Thanks for addressing the issue, @elliot!

  • Hi @alexander-albrecht

    This is my task for today. I have an idea for a neat solution, and will reply back with some code to test soon

  • Hi guys

    great news!
    I’ve been able to add in compatibility with the 3rd parry field type settings.

    ACF should now read in previous ‘time_format’, ‘date_format’ and ‘get_as_timestamp’ settings.

    If possible, please login to your online account and click on the ‘See all versions’ link next to your ACF PRO license. On the following page you will see a new version 5.3.9.2-RC1 available for download.
    http://www.advancedcustomfields.com/my-account

    After replacing the plugin files, can you please let me know if this improves the issue (ACF correctly displays previous values with correct date/time settings)?

    Please also remember to hard refresh your browser to clear cached JS.

  • Hey guys. Just updated the RC1 files. Please re-download for the latest build.

  • Hi Elliot,

    Just tested with 5.3.9.2-RC1 on a two test sites that were using the 3rd party plugin. I can not see any issues with the time formatting on fields that were created with the 3rd party plugin now.

    Thanks very much for your efforts with this.

Viewing 25 posts - 1 through 25 (of 25 total)

The topic ‘Date/Time picker in 5.3.9 causes trouble…’ is closed to new replies.