// // 男性 demo 2038年2月
// var type = 1;
// var year = 1975 // 出生年份
// var mouth = 6 // 出生月份

// // 男性 demo 2051年9月
// var type = 1;
// var year = 1988 // 出生年份
// var mouth = 9 // 出生月份

// // 男性 demo 2026年5月
// var type = 1;
// var year = 1966 // 出生年份
// var mouth = 1 // 出生月份

// // 男性 demo 2025年2月
// var type = 1;
// var year = 1965 // 出生年份
// var mouth = 1 // 出生月份

// // 女性 55 demo  2025年8月
// var type = 2;
// var year = 1970 // 出生年份
// var mouth = 6 // 出生月份

// 女性 55 demo  2025年2月
var type = 2;
var year = 1970 // 出生年份
var mouth = 1 // 出生月份

// // 女性 55 demo  2026年11月
// var type = 2;
// var year = 1971 // 出生年份
// var mouth = 6 // 出生月份

// // 女性 55 demo  2046年9月
// var type = 2;
// var year = 1988 // 出生年份
// var mouth = 9 // 出生月份

// // 女性 55 demo  2025年2月
// var type = 2;
// var year = 1970 // 出生年份
// var mouth = 1 // 出生月份

// // 女性 55 demo  2025年12月
// var type = 2;
// var year = 1970 // 出生年份
// var mouth = 9 // 出生月份


// // 女性 50 demo  2027年3月
// var type = 3;
// var year = 1976 // 出生年份
// var mouth = 6 // 出生月份

// // 女性 50 demo  2025年9月
// var type = 3;
// var year = 1975 // 出生年份
// var mouth = 6 // 出生月份

// // 女性 50 demo  2025年2月
// var type = 3;
// var year = 1975 // 出生年份
// var mouth = 1 // 出生月份

// // 女性 50 demo  2028年2月
// var type = 3;
// var year = 1977 // 出生年份
// var mouth = 1 // 出生月份

// // 女性 50 demo  2039年11月
// var type = 3;
// var year = 1984 // 出生年份
// var mouth = 11 // 出生月份

// // 女性 50 demo  2043年9月
// var type = 3;
// var year = 1988 // 出生年份
// var mouth = 9 // 出生月份

// 初始化
var minYear = 0//
var retireMouth = 0// 总退休月份(旧政策)
var interval =  0// 每4个月延迟1个月
var maxDelayMouth = 0// 最大延迟月份

switch (type){
	case 1: // 男性
		minYear = 1965 //
		retireMouth = 60 * 12 // 总退休月份(旧政策)
		interval = 4 // 每4个月延迟1个月
		maxDelayMouth = 36 // 最大延迟月份
    case 3:
        // 女性 50
         minYear = 1975 //
         retireMouth = 50 * 12 // 总退休月份(旧政策)
         interval = 2 // 每2个月延迟1个月
        maxDelayMouth = 60 // 最大延迟月份
         break;
    case 2:
        // 女性 55
         minYear = 1970 //
         retireMouth = 55 * 12 // 总退休月份(旧政策)
         interval = 4 // 每4个月延迟1个月
         maxDelayMouth = 36 // 最大延迟月份
        break;
	default:
		console.log("请选择类型")
		return;
}


delayMouth = 0 // 延迟月份
if (year >= minYear){
    surplusMouth = (year - minYear) * 12  + mouth;

    // console.log(surplusMouth)

    if (surplusMouth > interval) {
        remainder = surplusMouth % interval
        if ( remainder > 0 ){
            delayMouth = delayMouth + 1
        }
        delayMouth = delayMouth + (surplusMouth - remainder) / interval
    }else{
        delayMouth = 1
    }
}

if (delayMouth > maxDelayMouth){
    delayMouth = maxDelayMouth
}

console.log(delayMouth) // 延迟月份

totalMouth = retireMouth + delayMouth + mouth
retireMouth = totalMouth % 12
retireYear = (totalMouth - retireMouth) / 12

if (retireMouth == 0){
    retireMouth = 12
    retireYear - 1
}


console.log(retireMouth)   // 退休月份
console.log(year + retireYear)  // 退休年份
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐