Skip to content

Instantly share code, notes, and snippets.

@csaborio001
Created December 23, 2019 00:39
Show Gist options
  • Save csaborio001/bcd95a775f64fbebe36166a68ef19261 to your computer and use it in GitHub Desktop.
Save csaborio001/bcd95a775f64fbebe36166a68ef19261 to your computer and use it in GitHub Desktop.
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