lib/util-browser.js
function top(date, fmt) {
            fmt = fmt || '%Y-%M-%dT%H:%m:%sZ';

            function pad(value) {
                return (value.toString().length < 2) ? '0' + value : value;
            };

            return fmt.replace(/%([a-zA-Z])/g, function (_, fmtCode) {
                switch (fmtCode) {
                    case 'Y':
                        return date.getUTCFullYear();
                    case 'M':
                        return pad(date.getUTCMonth() + 1);
                    case 'd':
                        return pad(date.getUTCDate());
                    case 'H':
                        return pad(date.getUTCHours());
                    case 'm':
                        return pad(date.getUTCMinutes());
                    case 's':
                        return pad(date.getUTCSeconds());
                    default:
                        throw new Error('Unsupported format code: ' + fmtCode);
                }
            });
        }
function top(date, fmt) {
            fmt = fmt || '%Y-%M-%dT%H:%m:%sZ';

            function pad(value) {
                return (value.toString().length < 2) ? '0' + value : value;
            };

            return fmt.replace(/%([a-zA-Z])/g, function (_, fmtCode) {
                switch (fmtCode) {
                    case 'Y':
                        return date.getUTCFullYear();
                    case 'M':
                        return pad(date.getUTCMonth() + 1);
                    case 'd':
                        return pad(date.getUTCDate());
                    case 'H':
                        return pad(date.getUTCHours());
                    case 'm':
                        return pad(date.getUTCMinutes());
                    case 's':
                        return pad(date.getUTCSeconds());
                    default:
                        throw new Error('Unsupported format code: ' + fmtCode);
                }
            });
        }
function top ( date , fmt ) { fmt = fmt || '%Y-%M-%dT%H:%m:%sZ' ; function pad ( value ) { return ( value . toString ( ) . length < 2 ) ? '0' + value : value ; } ; return fmt . replace ( / %([a-zA-Z]) / g , function ( _ , fmtCode ) { switch ( fmtCode ) { case 'Y' : return date . getUTCFullYear ( ) ; case 'M' : return pad ( date . getUTCMonth ( ) + 1 ) ; case 'd' : return pad ( date . getUTCDate ( ) ) ; case 'H' : return pad ( date . getUTCHours ( ) ) ; case 'm' : return pad ( date . getUTCMinutes ( ) ) ; case 's' : return pad ( date . getUTCSeconds ( ) ) ; default : throw new Error ( 'Unsupported format code: ' + fmtCode ) ; } } ) ; }
for taobao open platform
for taobao open platform