-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
89 lines (70 loc) · 3.1 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
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Playwrite+TZ:[email protected]&display=swap" rel="stylesheet">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Certificado de Namoro</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
* {
font-family: "Playwrite TZ", cursive;
}
</style>
</head>
<body class="bg-gray-200 text-gray-900 min-h-screen flex justify-center items-center">
<div class="bg-gray-50 border border-gray-100 p-12 rounded flex justify-center items-center flex-col max-w-[768px] mx-4 my-8 md:mx-0 drop-shadow">
<div class="flex gap-4 justify-between items-center flex-col mb-12">
<h1 class="text-4xl bold text-center">Certidão de namoro</h1>
<span class="text-sm" id="birthday">04/07/2022</span>
<img src="public/cats.png" alt="">
</div>
<p class="text-lg mb-16">
Qualquer um que tomasse o seu lugar seria um substituto fraco. Amo você,
com um amor tão grande que simplesmente não pode continuar crescendo no coração,
precisa saltar para fora e se revelar em toda magnitude.
</p>
<div class="flex flex-col sm:flex-row gap-8 sm:gap-0 justify-between items-center w-full sm:px-12 mb-12">
<div class="flex flex-col items-center justify-center">
<img class="w-16 mb-4" src="public/digital.png" alt="">
<strong class="underline text-sm">Francielly Oliveira de Souza</strong>
<span>namorada</span>
</div>
<div class="flex flex-col items-center justify-center">
<img class="w-16 mb-4" src="public/digital.png" alt="">
<strong class="underline text-sm">João A. L. Gonçalves</strong>
<span>namorado</span>
</div>
</div>
<p class="text-center">Um compromisso para a vida toda.</p>
<script>
function getRelativeDateText() {
const birthdaySpanHtml = document.getElementById("birthday");
const date = new Date('2022-07-04T00:00:00Z');
const now = new Date();
const diffInMilliseconds = now - date;
const millisecondsInMonth = 30 * 24 * 60 * 60 * 1000;
const millisecondsInYear = 12 * millisecondsInMonth;
const diffInYears = Math.floor(diffInMilliseconds / millisecondsInYear);
const diffInMonths = Math.floor((diffInMilliseconds % millisecondsInYear) / millisecondsInMonth);
let result = '';
if (diffInYears > 0) {
result += `${diffInYears} ${diffInYears === 1 ? 'ano' : 'anos'}`;
}
if (diffInMonths > 0) {
if (result) result += ' e ';
result += `${diffInMonths} ${diffInMonths === 1 ? 'mês' : 'meses'}`;
}
if (!result) {
result = 'menos de um mês';
}
const text = `${birthdaySpanHtml.innerText} - ${result}`
birthdaySpanHtml.innerText = text
}
getRelativeDateText()
</script>
</div>
</body>
</html>