Tribe__Date_Utils::maybe_format_from_datepicker( string $date, string|int $datepicker = null )

Try to format a Date to the Default Datepicker format


Parameters

$date

(string) (Required) Original Date that came from a datepicker

$datepicker

(string|int) (Optional) Datepicker format

Default value: null


Top ↑

Return

(string)


Top ↑

Source

File: src/Tribe/Date_Utils.php

		public static function maybe_format_from_datepicker( $date, $datepicker = null ) {
			if ( ! is_numeric( $datepicker ) ) {
				$datepicker = tribe_get_option( 'datepickerFormat' );
			}

			if ( is_numeric( $datepicker ) ) {
				$datepicker = self::datepicker_formats( $datepicker );
			}

			$default_datepicker = self::datepicker_formats( 0 );

			// If the current datepicker is the default we don't care
			if ( $datepicker === $default_datepicker ) {
				return $date;
			}

			return self::datetime_from_format( $datepicker, $date );
		}

Top ↑

Changelog

Changelog
Version Description
4.5.12 Introduced.