Support

Account

Home Forums Backend Issues (wp-admin) Date picker display disappearing

Solved

Date picker display disappearing

  • Hello-

    I have a date picker that uses the save format “yy” and display format “mm/dd/yy”. On save of the CPT I’m working on (and others I have tested), the mm/dd/yy is not saved, but the appropriate yy format does show up using the_field.

    Thought you would like to know. Let me know if you’d like to see it in action (screencast) or want me to do some testing.

    ~Kyle~

    p.s. latest versions of WP & ACF

  • Kyle, are you using the date/time picker plugin with ACF? If so, that’s the problem. That plugin is poorly supported and doesn’t seem coded very well and I’ve often run into the exact problem you’re having when using it.

  • Well, I’m using the picker provided by ACF (the plugin) if that’s what you mean? I’m not using an additional plugin to ACF for anything at this point.

  • Hi @thecorkboard

    I think the solution to the issue in your description itself. You say that you are only saving the yy. ACF would require that you save the yy, mm, and dd to render a value into the date picker field.

    To sum up, your save_format requires more than just the yy value.

    Thanks
    E

  • Hi @elliot-

    Yep, I’m only saving the yy because I only need to display the yy on the front-end. So, now that I understand that ACF requires mm/dd/yy, I now need to work out to only display the yy portion of the date. If you have a hint, that’d be great. Otherwise it may just be easier to use a text field.

    Thanks

  • Hi @thecorkboard

    Please save the date data as yymmdd. This is the default and most effective format.

    To then retrieve only the year data, you can do this:

    
    $date = get_field('date');
    // $date = 19881123 (23/11/1988)
     
    // extract Y,M,D
    $y = substr($date, 0, 4);
    

    source: http://www.advancedcustomfields.com/resources/field-types/date-picker/

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

The topic ‘Date picker display disappearing’ is closed to new replies.