"use strict";
var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 数据转换
 */
var DataConversion = (function () {
    function DataConversion() {
    }
    DataConversion.doConversion = function (val) {
        var l = val.toString().length;
        var text = "";
        if (l < 4) {
            text = val;
        }
        else if (l >= 4 && l < 5) {
            //text = (val / 1000).toFixed(1).toString() + "k"
            text = (Math.floor((val / 1000) * 100) / 100).toString() + "k";
        }
        else if (l >= 5 && l < 7) {
            //text = (val / 10000).toFixed(1).toString() + "w"
            text = (Math.floor((val / 10000) * 100) / 100).toString() + "w";
        }
        else if (l >= 7 && l < 9) {
            //text = (val / 1000000).toFixed(1).toString() + "m"
            text = (Math.floor((val / 1000000) * 100) / 100).toString() + "m";
        }
        else if (l >= 9 && l < 10) {
            //text = (val / 100000000).toFixed(1).toString() + "E"
            text = (Math.floor((val / 100000000) * 100) / 100).toString() + "E";
        }
        else if (l >= 10 && l < 12) {
            //text = (val / 1000000000).toFixed(1).toString() + "b"
            text = (Math.floor((val / 1000000000) * 100) / 100).toString() + "b";
        }
        else if (l >= 12 && l < 13) {
            //text = (val / 100000000000).toFixed(1).toString() + "t"
            text = (Math.floor((val / 100000000000) * 100) / 100).toString() + "t";
        }
        else if (l >= 13 && l < 17) {
            //text = (val / 1000000000000).toFixed(1).toString() + "g"
            text = (Math.floor((val / 1000000000000) * 100) / 100).toString() + "g";
        }
        else if (l >= 17) {
            //text = (val / 10000000000000000).toFixed(1).toString() + "z"
            text = (Math.floor((val / 10000000000000000) * 100) / 100).toString() + "z";
        }
        //console.log(text)
        return text;
    };
    DataConversion.prototype.isSameDay = function (timer1, timer2) {
        if (this.formatTime(timer1, "yyyy-MM-dd") == this.formatTime(timer2, "yyyy-MM-dd")) {
            return true;
        }
        else {
            return false;
        }
    };
    DataConversion.prototype.formatTime = function (date, fmt) {
        var o = {
            "M+": date.getMonth() + 1,
            "d+": date.getDate(),
            "h+": date.getHours(),
            "m+": date.getMinutes(),
            "s+": date.getSeconds(),
            "q+": Math.floor((date.getMonth() + 3) / 3),
            "S": date.getMilliseconds() // 毫秒
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    };
    return DataConversion;
}());
exports.default = DataConversion;
__reflect(DataConversion.prototype, "\"c:/Users/duiba/Documents/kuwo/egret/src/mainScene/DataConversion\".DataConversion");
//# sourceMappingURL=DataConversion.js.map