lib/utils.js
function index_date(timestamp, interval) {
    function double_digitize(str) {
        return (str.length === 1) ? ('0' + str) : str;
    }

    var year = timestamp.getUTCFullYear();
    var month = (timestamp.getUTCMonth() + 1).toString();

    switch (interval) {
        case 'day':
            var day = timestamp.getUTCDate().toString();
            return [year, double_digitize(month), double_digitize(day)].join('.');

        case 'week':
            var week = current_week_number(timestamp);
            return [year, double_digitize(week)].join('.');

        case 'month':
            return [year, double_digitize(month)].join('.');

        case 'year':
            return year;

        case 'none':
            return '';

        default:
            throw new Error('invalid interval: ' + interval + '; accepted intervals are "day", "week", "month", "year", and "none"');
    }
}
function index_date(timestamp, interval) {
    function double_digitize(str) {
        return (str.length === 1) ? ('0' + str) : str;
    }

    var year = timestamp.getUTCFullYear();
    var month = (timestamp.getUTCMonth() + 1).toString();

    switch (interval) {
        case 'day':
            var day = timestamp.getUTCDate().toString();
            return [year, double_digitize(month), double_digitize(day)].join('.');

        case 'week':
            var week = current_week_number(timestamp);
            return [year, double_digitize(week)].join('.');

        case 'month':
            return [year, double_digitize(month)].join('.');

        case 'year':
            return year;

        case 'none':
            return '';

        default:
            throw new Error('invalid interval: ' + interval + '; accepted intervals are "day", "week", "month", "year", and "none"');
    }
}
function index_date ( timestamp , interval ) { function double_digitize ( str ) { return ( str . length === 1 ) ? ( '0' + str ) : str ; } var year = timestamp . getUTCFullYear ( ) ; var month = ( timestamp . getUTCMonth ( ) + 1 ) . toString ( ) ; switch ( interval ) { case 'day' : var day = timestamp . getUTCDate ( ) . toString ( ) ; return [ year , double_digitize ( month ) , double_digitize ( day ) ] . join ( '.' ) ; case 'week' : var week = current_week_number ( timestamp ) ; return [ year , double_digitize ( week ) ] . join ( '.' ) ; case 'month' : return [ year , double_digitize ( month ) ] . join ( '.' ) ; case 'year' : return year ; case 'none' : return '' ; default : throw new Error ( 'invalid interval: ' + interval + '; accepted intervals are "day", "week", "month", "year", and "none"' ) ; } }
YYYY.MM.dd
YYYY . MM . dd