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

Forms: get rid of jQuery for date picker #41081

Open
simison opened this issue Jan 15, 2025 · 2 comments
Open

Forms: get rid of jQuery for date picker #41081

simison opened this issue Jan 15, 2025 · 2 comments
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Feature] Forms Blocks Blocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc. [Focus] Performance [Package] Forms [Pri] Normal

Comments

@simison
Copy link
Member

simison commented Jan 15, 2025

Get rid of jQuery requirement for Jetpack Forms date field; it's a big library to load just to show a simple date picker.

Image

jQuery( function ( $ ) {
const $input = $( '.contact-form input.jp-contact-form-date' );
const dateFormat = $input.attr( 'data-format' ) || 'yy-mm-dd';
$input.datepicker( {
dateFormat,
constrainInput: false,
showOptions: { direction: 'down' },
} );
} );

@simison simison added [Focus] Performance [Block] Contact Form Form block (also see Contact Form label) [Package] Forms [Feature] Forms Blocks Blocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc. [Pri] Normal labels Jan 15, 2025
Copy link
Contributor

This issue could use some more labels, to help prioritize and categorize our work. Could you please add at least a [Type], a [Feature], and a [Pri] label?

@simison
Copy link
Member Author

simison commented Jan 15, 2025

We should try using native <input type="datetime-local" />: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Feature] Forms Blocks Blocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc. [Focus] Performance [Package] Forms [Pri] Normal
Projects
None yet
Development

No branches or pull requests

2 participants