// // 男性 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 = 1965 //
var retireMouth = 60 * 12 // 总退休月份(旧政策)
var interval = 4 // 每4个月延迟1个月
var maxDelayMouth = 36 // 最大延迟月份
switch (type){
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;
}
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) // 退休年份
js版 最新版退休年龄计算器公式 代码,与电子社保卡小程序的计算结果一致
于 2024-09-14 17:54:38 首次发布