exiting when invalid value is passed in as a date

@triblondon @AlbertoElias 

addresses https://github.com/Financial-Times/o-date/issues/19
yep

`x && y` is equivalent to `if (x) { y}`

Similar to how `x || y` is equivalent to `if (!x) { y}`

On 17 October 2014 10:31, Alberto Elias <notifications@github.com> wrote:

> In main.js:
>
> >  }
> >
> >  function format (date, dateFormat) {
> >  	dateFormat = dateFormat || 'datetime';
> >  	var tpl = compiledTemplates[dateFormat] || compile(dateFormat);
> > -	return tpl(toDate(date));
> > +	date = toDate(date)
> > +	return date && tpl(date);
>
> and if not, does it return undefined?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Financial-Times/o-date/pull/21/files#r19008919>.
>

-- 

------------------------------
This email was sent by a company owned by Pearson plc, registered office at 
80 Strand, London WC2R 0RL.  Registered in England and Wales with company 
number 53723.