设置一年后的今天:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function setdays() {
var d = new Date();
console.log(d);
var year = d.getFullYear();
if (year % 4 === 0 && year % 100 != 0 || year % 400 === 0) {
console.log(new Date(d.setDate(d.getDate() + 366)));;
} else {
console.log(new Date(d.setDate(d.getDate() + 365)));;
}
}
setdays();
</script>
</body>
</html>