Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (45 sloc) 1.44 KB
<html>
<head>
<title>New Tab</title>
<style>
body { background: #f6f6f6; color: #000; font-family: monaco; }
p { margin: -1.3em 0 0 0; padding: 0; position: relative; top: 50%; text-align: center; width: 100%;
transform: translateY(-50%); -ms-transform: translateY(-50%); -webkit-transform: translateY(-50%); }
#year { font-size: 80px; }
#deciyear { font-size: 27px; position: relative; bottom: 27px; right: 9px; }
</style>
</head>
<body>
<p>
<b id="year"></b>
<span id="deciyear"></span>
</p>
<script>
var dob = new Date("January 1, 1980 00:00:00");
function getYear(now) {
var year = now.getFullYear() - dob.getFullYear();
var delta = new Date(now.getTime());
delta.setFullYear(dob.getFullYear());
if (delta < dob) {
year -= 1;
}
return year.toString();
}
function getDeciyear(now) {
var delta = new Date(now.getTime());
delta.setFullYear(dob.getFullYear());
if (delta < dob) {
delta.setFullYear(delta.getFullYear() + 1);
}
var duration = delta - dob;
var decisecondsInYear = 31556900000;
return (duration / decisecondsInYear).toFixed(9).toString().split(".")[1];
}
setInterval(function() {
var now = new Date();
document.getElementById("year").innerHTML = getYear(now);
document.getElementById("deciyear").innerHTML = "." + getDeciyear(now);
}, 100);
</script>
</body>
</html>