Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date_format parameter not applied to non-timestamp based date inputs. #39

Closed
tw2113 opened this issue Sep 24, 2014 · 8 comments
Closed

Comments

@tw2113
Copy link
Contributor

tw2113 commented Sep 24, 2014

Looks like date_format is only ever applied inside of text_date_timestamp(). I would assume we want it to be applicable to text_time and text_date, but I'll leave it up to your discretion

@danielmilner
Copy link

It appears that text_date honors the date_format, but only when you edit and re-save the record. It may be that the date picker is not honoring the date_format.

@yivi
Copy link
Contributor

yivi commented Mar 11, 2015

I can confirm that something goes weird regarding 'date_format'.

This code:

$main->add_field(
        [
            'name'        => __( 'Fecha', 'ojiva-plugin' ),
            'id'          => $prefix . 'fecha_realizacion',
            'type'        => 'text_date',
            'date_format' => 'd-m-Y'
        ]
    );

Produces this:
screen shot 2015-03-11 at 11 20 44

@tacone
Copy link

tacone commented Oct 29, 2015

That's precisely what happens to me, the format is applied to the textbox, but not to the datepicker.

@tacone
Copy link

tacone commented Oct 29, 2015

My current workaround:

$('.cmb2-datepicker').focus(function () {
        var val = $(this).val();
        $(this).datepicker("option", "dateFormat", "dd/mm/yy");
        $(this).val(val);
});

@yivi
Copy link
Contributor

yivi commented Oct 29, 2015

@tacone, I have working fix in #446.
You can checkout my fork at https://github.com/yivi/CMB2, which fixes all these problems. If you can test it out to confirm things are working as expected, it would be nice.

Hopefully at some point we can finish integrating my PR into the main project.

Regards.

@tacone
Copy link

tacone commented Oct 29, 2015

I can't test right now, as I'm a under a tight deadline, will surely do in the next project.

Thank you for now.

@jtsternberg
Copy link
Member

This should be good in trunk. Huge thanks for @yivi's work. Please test.

@tnorthcutt
Copy link

Closing as this looks resolved; @jtsternberg please reverse if I'm wrong 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants