node.js中art-template自定义时间函数dateFormat支持中英日期

去下载js的dateFormat,比较全日期处理函数

dateFormat怎样使用:http://blog.stevenlevithan.com/archives/date-time-format

下载地址:http://stevenlevithan.com/assets/misc/date.format.js

下载完成后,进行如下修改:

//date.format.js
var arttemplate = require('art-template');
var dateFormat = function () {
    var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
        timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
        timezoneClip = /[^-+\dA-Z]/g,
        pad = function (val, len) {
            val = String(val);
            len = len || 2;
            while (val.length < len) val = "0" + val;
            return val;
        };

    // Regexes and supporting funct

你可能感兴趣的:(node,art-template,js)