(function() { var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined'; var __module = nodeEnv ? module : {exports:{}}; var __filename = 'preview-scripts/__node_modules/k8w-super-date/index.js'; var __require = nodeEnv ? function (request) { return cc.require(request); } : function (request) { return __quick_compile_project__.require(request, __filename); }; function __define (exports, require, module) { if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict"; /// function prependZero(matched, num) { return matched.length > 1 && num < 10 ? "0" + num : "" + num; } Date.prototype.format = function (pattern) { var _this = this; if (pattern === void 0) { pattern = 'YYYY-MM-DD hh:mm:ss'; } return pattern.replace(/y{2,}|Y{2,}/, function (v) { return (_this.getFullYear() + "").substr(4 - v.length); }) .replace(/M{1,2}/, function (v) { return prependZero(v, _this.getMonth() + 1); }) .replace(/D{1,2}|d{1,2}/, function (v) { return prependZero(v, _this.getDate()); }) .replace(/Q|q/, function (v) { return prependZero(v, Math.ceil((_this.getMonth() + 1) / 3)); }) .replace(/h{1,2}|H{1,2}/, function (v) { return prependZero(v, _this.getHours()); }) .replace(/m{1,2}/, function (v) { return prependZero(v, _this.getMinutes()); }) .replace(/s{1,2}/, function (v) { return prependZero(v, _this.getSeconds()); }) .replace(/SSS|S/, function (v) { var ms = '' + _this.getMilliseconds(); return v.length === 1 ? ms : "" + (ms.length === 1 ? '00' : ms.length === 2 ? '0' : '') + ms; }); }; Date.today = function () { var now = new Date(); return new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime(); }; } if (nodeEnv) { __define(__module.exports, __require, __module); } else { __quick_compile_project__.registerModuleFunc(__filename, function () { __define(__module.exports, __require, __module); }); } })();