mirror of
https://github.com/dyzulk/portfolio---react.git
synced 2026-01-26 05:25:27 +07:00
44 lines
1.3 KiB
HTML
44 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta name="description" content="Web site created using create-react-app" />
|
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;500;700;900&display=swap" rel="stylesheet" />
|
|
<title>Muhammad Herdy Iskandar</title>
|
|
|
|
<script>
|
|
window.onload = function () {
|
|
// Tanggal lahir Anda
|
|
var tanggalLahir = new Date('2003-04-20');
|
|
|
|
// Tanggal sekarang
|
|
var tanggalSekarang = new Date();
|
|
|
|
// Menghitung selisih tahun
|
|
var selisihTahun = tanggalSekarang.getFullYear() - tanggalLahir.getFullYear();
|
|
|
|
// Periksa apakah ulang tahun sudah lewat atau belum
|
|
if (tanggalSekarang.getMonth() < tanggalLahir.getMonth() || (tanggalSekarang.getMonth() === tanggalLahir.getMonth() && tanggalSekarang.getDate() < tanggalLahir.getDate())) {
|
|
selisihTahun--;
|
|
}
|
|
|
|
// Menampilkan umur
|
|
document.getElementById("umur").innerHTML = "Umur Anda adalah " + selisihTahun + " tahun.";
|
|
};
|
|
</script>
|
|
<style>
|
|
* {
|
|
font-family: 'Roboto', sans-serif;
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
<div id="root"></div>
|
|
</body>
|
|
|
|
</html> |