src/View/Helper/TimelineHelper.php
protected function _date($date = null) {
		if ($date === null || !$date instanceof \DateTimeInterface) {
			return '';
		}
		$datePieces = [];
		$datePieces[] = $date->format('Y');
		// JavaScript uses 0-indexed months, so we need to subtract 1 month from PHP's output
		$datePieces[] = (int)($date->format('m')) - 1;
		$datePieces[] = (int)$date->format('d');
		$datePieces[] = (int)$date->format('H');
		$datePieces[] = (int)$date->format('i');
		$datePieces[] = (int)$date->format('s');

		return 'new Date(' . implode(', ', $datePieces) . ')';
	}
protected function _date($date = null) {
		if ($date === null || !$date instanceof \DateTimeInterface) {
			return '';
		}
		$datePieces = [];
		$datePieces[] = $date->format('Y');
		// JavaScript uses 0-indexed months, so we need to subtract 1 month from PHP's output
		$datePieces[] = (int)($date->format('m')) - 1;
		$datePieces[] = (int)$date->format('d');
		$datePieces[] = (int)$date->format('H');
		$datePieces[] = (int)$date->format('i');
		$datePieces[] = (int)$date->format('s');

		return 'new Date(' . implode(', ', $datePieces) . ')';
	}
protected function _date ( $ date = null ) { if ( $ date === null || ! $ date instanceof \ DateTimeInterface ) { return '' ; } $ datePieces = [ ] ; $ datePieces [ ] = $ date -> format ( 'Y' ) ; // JavaScript uses 0-indexed months, so we need to subtract 1 month from PHP's output $ datePieces [ ] = ( int ) ( $ date -> format ( 'm' ) ) - 1 ; $ datePieces [ ] = ( int ) $ date -> format ( 'd' ) ; $ datePieces [ ] = ( int ) $ date -> format ( 'H' ) ; $ datePieces [ ] = ( int ) $ date -> format ( 'i' ) ; $ datePieces [ ] = ( int ) $ date -> format ( 's' ) ; return 'new Date(' . implode ( ', ' , $ datePieces ) . ')' ; }
Format date to JS code.

@param \DateTimeInterface|null $date
@return string
Format date to JS code .