src/helpers.js
/**
    Interprets `params.val` as a date or time to format and uses the custom `time`
    formats.
    @method formatTime
    @param {Object} chunk The dust Chunk object.
    @param {Object} context The dust Context object.
    @param {Object} bodies An object containing the dust bodies.
    @param {Object} params An object containing the parameters in the markup for this helper.
    @return {Object} The `chunk` parameter.
    */
Interprets `params.val` as a date or time to format and uses the custom `time`
formats.
Interprets ` params . val ` as a date or time to format and uses the custom ` time ` formats .
function formatTime(chunk, context, bodies, params) {
        var formatOptions,
            locales,
            val,
            formatter;
        params = params || {};
        if (!params.hasOwnProperty('val')) {
            throw new ReferenceError('@formatTime needs a `val` parameter');
        }
        val = tap(params.val, chunk, context);
        delete params.val;  
        val = new Date(val);
        assertIsDate(val, '@formatTime requires a valid date or timestamp `val`');
        formatOptions = getFormatOptions('time', chunk, params, context);
        locales = getLocales(chunk, params, context);
        formatter = getDateTimeFormat(locales, formatOptions);
        chunk.write(dust.escapeHtml(formatter.format(val)));
        return chunk;
    }
function formatTime ( chunk , context , bodies , params ) { var formatOptions , locales , val , formatter ; params = params || { } ; if ( ! params . hasOwnProperty ( 'val' ) ) { throw new ReferenceError ( '@formatTime needs a `val` parameter' ) ; } val = tap ( params . val , chunk , context ) ; delete params . val ; val = new Date ( val ) ; assertIsDate ( val , '@formatTime requires a valid date or timestamp `val`' ) ; formatOptions = getFormatOptions ( 'time' , chunk , params , context ) ; locales = getLocales ( chunk , params , context ) ; formatter = getDateTimeFormat ( locales , formatOptions ) ; chunk . write ( dust . escapeHtml ( formatter . format ( val ) ) ) ; return chunk ; }
Interprets `params.val` as a date or time to format and uses the custom `time`
formats.
Interprets ` params . val ` as a date or time to format and uses the custom ` time ` formats .
// since params might be interpretted as format options