-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (77 loc) · 2.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧡 Maria Eduarda ❤</title>
<style>
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
font-family: Arial, sans-serif;
margin: 0;
background-color: #ffffff; /* Set background color to white */
background-image: url('./background.jpg'); /* Add your floral background image */
background-repeat: repeat; /* Repeat the background image */
background-size: cover; /* Cover the entire background */
}
.counter {
font-size: 3em;
text-align: center;
margin: 10px;
text-shadow: 1px 1px 4px #000000;
color: white;
}
.name {
max-width: 75%;
}
@media (max-width: 600px) {
.counter {
font-size: 2.5em;
}
.name {
max-width: 100%;
}
}
</style>
</head>
<body>
<div id="name" class="counter"><img class="name" src="./name.png"></div>
<div id="counter" class="counter"></div>
<script>
const startDate = new Date('2023-08-28');
startDate.setDate(startDate.getDate() - (8 * 7 + 1));
function getCounterOutput(date) {
const startDate = new Date('2023-08-28');
startDate.setDate(startDate.getDate() - (8 * 7 + 1));
const now = new Date(date);
const diffTime = Math.abs(now - startDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
const diffWeeks = Math.floor(diffDays / 7);
const remainingDays = diffDays % 7;
return `${diffWeeks} semanas e ${remainingDays} dias 🥰👶`;
}
// Generate dates between two dates
function getDates(startDate, endDate) {
const dates = [];
let currentDate = startDate;
while (currentDate <= endDate) {
dates.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
return dates;
}
// Tests
getDates(new Date('2023-08-29'), new Date('2024-04-07')).forEach(date => {
console.log(date.toLocaleDateString(), getCounterOutput(date.toISOString().split('T')[0]));
});
function updateCounter() {
const now = new Date();
document.getElementById('counter').textContent = getCounterOutput(now);
}
updateCounter();
</script>
</body