{{- $end_date := "" -}} {{- if . -}} {{- $end_date = . -}} {{- else -}} {{- $end_date = ( now.Format "2006-01-02" ) -}} {{- end -}} {{- return ( printf "new Date('%s')" $end_date ) -}}