woocommerce_date_input_html_pattern

The WooCommerce woocommerce date input html pattern hook.

Description

apply_filters( 'woocommerce_date_input_html_pattern', (string) $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01 ); 

Parameters (1)

0. $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01 (string) => '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])'
The 0 9 4 0 1 9 1 012 0 1 9 1 0 9 2 0 9 3 01.

Usage

To run the hook, copy the example below.
  1. $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01 = apply_filters( 'woocommerce_date_input_html_pattern', $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01 ); 
  2.  
  3. if ( !empty( $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01 ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_date_input_html_pattern callback 
  2. function filter_woocommerce_date_input_html_pattern( $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01 ) { 
  3. // make filter magic happen here... 
  4. return $0_9_4_0_1_9_1_012_0_1_9_1_0_9_2_0_9_3_01
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_date_input_html_pattern', 'filter_woocommerce_date_input_html_pattern', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_date_input_html_pattern', 'filter_woocommerce_date_input_html_pattern', 10, 1 ); 

Defined (7)

The filter is defined in the following location(s).

/includes/admin/meta-boxes/views/html-variation-admin.php  
  1. <input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . $loop . ']" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" /> 
  1. <input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[' . $loop . ']" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" /> 
/includes/admin/meta-boxes/views/html-product-data-general.php  
  1. <input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . _x( 'From…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" /> 
  1. <input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . _x( 'To…', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" /> 
/includes/admin/meta-boxes/views/html-order-download-permission.php  
  1. <input type="text" class="short date-picker" name="access_expires[<?php echo $loop; ?>]" value="<?php echo ! is_null( $download->get_access_expires() ) ? date_i18n( 'Y-m-d', $download->get_access_expires()->getTimestamp() ) : ''; ?>" maxlength="10" placeholder="<?php esc_attr_e( 'Never', 'woocommerce' ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" /> 
/includes/admin/meta-boxes/class-wc-meta-box-order-data.php  
  1. <input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="<?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?>" />@‎<input type="number" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" min="0" max="23" step="1" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="([01]?[0-9]{1}|2[0-3]{1})" />:<input type="number" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" min="0" max="59" step="1" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="[0-5]{1}[0-9]{1}" />‎ 
/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php  
  1. 'pattern' => apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ),