js 中国标准时间加月数 ,标准日期转中国标准时间

/**
     * 中国标准时间加月数
     * **/
    function DateAdd (interval, number, date) {
        switch (interval) {
        case 'm ': {
            date.setMonth(date.getMonth() + number);
            return date;
            // eslint-disable-next-line no-unreachable
            break;
        }
        default: {
            return date;
            // eslint-disable-next-line no-unreachable
            break;
        }
        }
    }
// 用法
 var newDate = DateAdd('m ',12, this.changeTime);

    /**
     *标准日期转中国标准时间
     * **/
    function formatterDate (date) {
        let result = new Date(date);
        return result;
    }
// 用法
 this.changeTime = formatterDate(this.orderDeatil.payTime)

js 中国标准时间加月数 ,标准日期转中国标准时间

猜你喜欢

转载自blog.csdn.net/qq706352062/article/details/108000402