作者 刘晓艳

保障其

... ... @@ -553,21 +553,32 @@ Page({
var birthday='1995-04-20'
var birthday_year = parseInt(new Date(birthday).getFullYear())
var tempbirth_time=''
if (unit == '年') {
runnian = parseInt(time_name / 4)
cha = time_name - runnian
var dateTemp = compact_time.split("-");
var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);
var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);
var rDate = new Date(millSeconds);
var year = rDate.getFullYear();
var month = rDate.getMonth() + 1;
if (month < 10) month = "0" + month;
var date = rDate.getDate();
if (date < 10) date = "0" + date;
console.log(year + "-" + month + "-" + date);
var millSeconds = Math.abs(nDate) - (1 * 24 * 60 * 60 * 1000);
// runnian = parseInt(time_name / 4)
// cha = time_name - runnian
// var dateTemp = compact_time.split("-");
// var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);
// var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);
// var rDate = new Date(millSeconds);
// var year = rDate.getFullYear();
// var month = rDate.getMonth() + 1;
// if (month < 10) month = "0" + month;
// var date = rDate.getDate();
// if (date < 10) date = "0" + date;
// console.log(year + "-" + month + "-" + date);
}else if(unit=='岁'){
var temp_year = (birthday_year + time_name - 1)
var temp_month = month
tempbirth_time = temp_year + '-' + temp_month + '-'+day
console.log(tempbirth_time)
}
},
... ...