X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Ftemplate-helper.js;h=a20d1aec13721cfda098ef7514df175422f51dfa;hb=e2c0fe7d1ab89eb892cad2f9003391c2e41010e7;hp=7e1693c857758c127d1063d30804c6c5fab9b2e6;hpb=2a4abfad091846a4fa528b44a31962c5150e6b0a;p=squeep-html-template-helper diff --git a/lib/template-helper.js b/lib/template-helper.js index 7e1693c..a20d1ae 100644 --- a/lib/template-helper.js +++ b/lib/template-helper.js @@ -4,7 +4,7 @@ * A bunch of shorthand to put together common parts of an HTML page. */ -const { lazy } = require('@squeep/lazy'); +const { lazy } = require('@squeep/lazy-property'); /** * Some fields may have values outside normal dates, handle them here. @@ -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; }