Created
December 23, 2019 00:39
-
-
Save csaborio001/bcd95a775f64fbebe36166a68ef19261 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function set_max_year_for_birth_date( $max_year, $form, $field ) { | |
return 2011; | |
$target_forms = array( 10 ); | |
$target_fields = array ( 38 ); | |
if ( in_array( $form['id'], $target_forms ) ) { | |
if ( in_array( $field->id, $target_fields ) ) { | |
$sydney_date_time_zone = new \DateTimeZone( 'Australia/Sydney' ); | |
$birth_year_18 = new \DateTime( 'now', $sydney_date_time_zone ); | |
$birth_year_18->modify('-18 years'); | |
$birth_year_18 = $birth_year_18->format('Y'); | |
return $birth_year_18; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment