-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
72 lines (68 loc) · 2.48 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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Jalali Calendar JS</title>
</head>
<body>
<h1>Jalali Calendar JS</h1>
<p></p>
<section>
<b>Today date: <span class="label-today-date"></span></b>
<br />
<b
>First day of current year: <span class="label-first-day-of-year"></span
></b>
<br />
<b
>First day of current week: <span class="label-first-day-of-week"></span
></b>
<br />
<b
>Number of days in the current month:
<span class="label-numbers-of-days-current-month"></span
></b>
<br />
<b
>Number of days in the current year:
<span class="label-numbers-of-days-current-year"></span
></b>
<br />
</section>
<script type="text/javascript" src="./dist/jalali-calendar-js.js"></script>
<script type="text/javascript">
// Elements
const label_today_date = document.querySelector(".label-today-date");
const label_first_day_of_year = document.querySelector(
".label-first-day-of-year"
);
const label_first_day_of_week = document.querySelector(
".label-first-day-of-week"
);
const label_numbers_of_days_current_month = document.querySelector(
".label-numbers-of-days-current-month"
);
const label_numbers_of_days_current_year = document.querySelector(
".label-numbers-of-days-current-year"
);
// Variables
// .toLocaleString("en-US", {timeZone: "Asia/Tehran"});
// const today_date_jalali = new Date(today_date).toLocaleDateString("fa-IR");
const today_date = new Date();
const year = new Date().getFullYear();
const month = new Date().getMonth();
const day = new Date().getDate();
// Labels
const today = jalaliDate(year, month, day);
label_today_date.innerText = `${today["year"]}/${
today["month"] < 10 ? "0" + today["month"] : today["month"]
}/${today["day"] < 10 ? "0" + today["day"] : today["day"]}`;
label_first_day_of_year.innerText = firstDayOfYear(year);
label_first_day_of_week.innerText = firstDayOfMonth(year, month);
label_numbers_of_days_current_month.innerText = daysOfMonth(year, month);
label_numbers_of_days_current_year.innerText = daysOfYear(year, month);
</script>
</body>
</html>