get_value(); $formatted_field_value = strtotime( $data['field_value'] ); $formatted_compared_value = strtotime( $compared_value['hours'] . ':' . $compared_value['minutes'] ); switch ( $this->get_operator() ) { case 'before': $result = $formatted_field_value <= $formatted_compared_value; break; case 'after': $result = $formatted_field_value >= $formatted_compared_value; break; case 'between': $formatted_start_interval = $formatted_compared_value; $formatted_end_interval = strtotime( $this->get_extra()['hours'] . ':' . $this->get_extra()['minutes'] ); $result = $formatted_field_value >= $formatted_start_interval && $formatted_field_value <= $formatted_end_interval; break; default: $result = false; } return $result; } public static function get_control_type() { return static::get_key(); } public static function get_operators() { return [ 'before' => [ 'label' => 'before', ], 'after' => [ 'label' => 'after', ], 'between' => [ 'label' => 'between', ], ]; } }