Skip to content

Commit d826b08

Browse files
gppa-google-sheets-filter-by-date.php: Added new snippet for changing the date format when searching for values in a Google Sheet.
1 parent fbccf0d commit d826b08

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Populate Anything + Google Sheets // Convert Date Format in Date Field for Search to m/d/y
4+
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
5+
* https://gravitywiz.com/populate-gravity-forms-with-google-sheets/
6+
*/
7+
add_filter( 'gppa_replace_filter_value_variables_google_sheet', function ( $filter_value ) {
8+
if ( is_array( $filter_value ) && rgar( $filter_value, 'year' ) && rgar( $filter_value, 'month' ) && rgar( $filter_value, 'day' ) ) {
9+
$filter_value = sprintf( '%s/%s/%s', $filter_value['month'], $filter_value['day'], $filter_value['year'] );
10+
}
11+
12+
return $filter_value;
13+
}, 11 );

0 commit comments

Comments
 (0)