__( 'Before', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'dateFormat' => "H:i", 'enableTime' => true, 'noCalendar' => true, ], 'label_block' => true, 'default' => '', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { // Split control valur into two dates $time = date( 'H:i', strtotime( preg_replace('/\s+/', '', $value ) ) ); $now = date( 'H:i', strtotime("now") + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); // Default returned bool to false $show = false; // Check vars if ( \DateTime::createFromFormat( 'H:i', $time ) === false ) // Make sure it's a valid DateTime format return; // Convert to timestamp $time_ts = strtotime( $time ); $now_ts = strtotime( $now ); // Check that user date is between start & end $show = ( $now_ts < $time_ts ); return $this->compare( $show, true, $operator ); } }