Code Duplication    Length = 5-5 lines in 2 locations

includes/CMB2_Field_Display.php 1 location

@@ 293-297 (lines=5) @@
290
		$datetime = maybe_unserialize( $this->value );
291
		$this->value = $tzstring = '';
292
293
		if ( $datetime && $datetime instanceof DateTime ) {
294
			$tz       = $datetime->getTimezone();
295
			$tzstring = $tz->getName();
296
			$this->value    = $datetime->getTimestamp();
297
		}
298
299
		$date = $this->field->get_timestamp_format( 'date_format', $this->value );
300
		$time = $this->field->get_timestamp_format( 'time_format', $this->value );

includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php 1 location

@@ 33-37 (lines=5) @@
30
		$datetime = maybe_unserialize( $args['value'] );
31
		$value = $tzstring = '';
32
33
		if ( $datetime && $datetime instanceof DateTime ) {
34
			$tz       = $datetime->getTimezone();
35
			$tzstring = $tz->getName();
36
			$value    = $datetime->getTimestamp();
37
		}
38
39
		$timestamp_args = wp_parse_args( $args['text_datetime_timestamp'], array(
40
			'desc'     => '',