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

Change HTML 5 input of type date format to local date format #504

Open
T-Specht opened this issue Aug 26, 2019 · 0 comments
Open

Change HTML 5 input of type date format to local date format #504

T-Specht opened this issue Aug 26, 2019 · 0 comments

Comments

@T-Specht
Copy link

T-Specht commented Aug 26, 2019

When using an input element of type text and setting the option "Input type" to Date, values are stored using the default HTML date format "YYYY-MM-DD".
From what I can tell, this is the expected behavior because as far as the plugin is concerned, the date itself is just a string of text which the browser is passing in the format of "YYYY-MM-DD".
Doing some research, I found that it is not possible to change the format the browser uses to output the date value. I, however, would like to save the date using the default format from the WordPress settings.

Is this possible using some PHP code with filters and actions? If so, could you please provide an example?

To clarify further: I imagine a PHP function which would run just before the data is being saved into the database and send via email. This function could then be used to modify the form submission accordingly. In my case, the function would transform all dates info local formats.

Form submissionFunction to transform dataSave to database, send email

Thank you in advance!

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

1 participant