X-Git-Url: http://git.squeep.com/?p=squeep-html-template-helper;a=blobdiff_plain;f=lib%2Ftemplate-helper.js;h=deb3a37fc183a4af3cecdea6dda250d4d8193bab;hp=7e1693c857758c127d1063d30804c6c5fab9b2e6;hb=5690ad318ed98cff45bf1fd192656a7156c7045c;hpb=aeb12ef4882c1cf630ba86de0108a7c2bb943589 diff --git a/lib/template-helper.js b/lib/template-helper.js index 7e1693c..deb3a37 100644 --- a/lib/template-helper.js +++ b/lib/template-helper.js @@ -29,7 +29,9 @@ const dateOrNot = (date, otherwise) => { /** * Why is rendering a Date as a string this complicated? - * @param {Date|Number} date + * We handle the infinities because pg-promise might provide those in + * lieu of a Date object from timestamp fields. + * @param {Date|Number|String} date * @param {String=} pInf * @param {String=} nInf * @param {String=} otherwise @@ -43,6 +45,7 @@ const dateFormat = (date, pInf = 'Never', nInf = 'Forever', otherwise = '') => { return nInf; default: if (!date + || Number.isNaN(date.valueOf()) || (!(date instanceof Date) && !isDatableType)) { return otherwise; }