-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
560 lines (504 loc) · 25.2 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
<!DOCTYPE html>
<html lang="en">
<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>Hebrew Calendar - Online Hebrew-Gregorian Calendar for Free Use</title>
<!-- Google Tag Manager -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-T7HFKFX0PR"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-T7HFKFX0PR');
</script>
<!-- SEO and Metadata -->
<meta name="author" content="Dor Pascal">
<meta name="generator" content="vscode">
<meta property="og:title" content="Hebrew Calendar">
<meta property="og:locale" content="en_US">
<meta name="description"
content="Explore the Hebrew calendar alongside Gregorian dates. Navigate between months to see corresponding Hebrew and Gregorian dates, including months.">
<meta name="keywords"
content="Hebrew Calendar, Jewish Calendar, Gregorian Calendar, Date Converter, Jewish Dates, Hebrew Dates">
<meta property="og:description"
content="Explore the Hebrew calendar alongside Gregorian dates. Navigate between months to see corresponding Hebrew and Gregorian dates.">
<meta property="og:url" content="https://dorpascal.com/hebrew-calendar/">
<meta property="og:site_name" content="Dor Pascal">
<meta property="og:type" content="website">
<meta property="og:image" content="https://dorpascal.com/hebrew-calendar/calendar-preview.webp">
<meta name="twitter:card" content="summary">
<meta property="twitter:title" content="Hebrew Calendar">
<meta name="theme-color" content="#3498db">
<meta name="apple-mobile-web-app-title" content="Hebrew Calendar">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="application-name" content="Hebrew Calendar">
<link rel="canonical" href="https://dorpascal.com/hebrew-calendar/">
<meta name="apple-itunes-app" content="app-id=6736856508">
<!-- Alternate Language Tags -->
<link rel="alternate" hreflang="en" href="https://dorpascal.com/hebrew-calendar/">
<link rel="alternate" hreflang="he" href="https://dorpascal.com/hebrew-calendar/he/">
<link rel="alternate" hreflang="x-default" href="https://dorpascal.com/hebrew-calendar/">
<!-- JSON-LD Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Hebrew Calendar",
"url": "https://dorpascal.com/hebrew-calendar/",
"applicationCategory": "Calendar Application",
"operatingSystem": "All",
"browserRequirements": "Requires JavaScript. Optimized for modern browsers.",
"author": {
"@type": "Person",
"name": "Dor Pascal"
},
"publisher": {
"@type": "Organization",
"name": "Dor Pascal"
},
"description": "Explore the Hebrew calendar alongside Gregorian dates. Navigate between months to see corresponding Hebrew and Gregorian dates.",
"image": "https://dorpascal.com/hebrew-calendar/calendar-preview.webp",
"softwareVersion": "1.0",
"datePublished": "2024-08-29",
"dateModified": "2024-08-29",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"reviewCount": "200"
}
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"name": "Breadcrumb List",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://dorpascal.com"
}, {
"@type": "ListItem",
"position": 2,
"name": "Hebrew Calendar",
"item": "https://dorpascal.com/hebrew-calendar/"
}]
}
</script>
<!-- Icons and Manifest -->
<link rel="icon" type="image/png" sizes="16x16" href="icons/Web/icons8-tear-off-calendar-windows-11-color-16.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/Web/icons8-tear-off-calendar-windows-11-color-32.png">
<link rel="icon" type="image/png" sizes="96x96" href="icons/Web/icons8-tear-off-calendar-windows-11-color-96.png">
<link rel="icon" type="image/png" sizes="120x120"
href="icons/Web/icons8-tear-off-calendar-windows-11-color-120.png">
<link rel="shortcut icon" href="https://dorpascal.com/favicon.ico">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<body>
<header>
<button class="theme-toggle" onclick="toggleTheme()">Toggle Theme</button>
<button id="menu-toggle" aria-label="Toggle menu">
<span></span>
<span></span>
<span></span>
</button>
<nav id="mobile-menu">
<ul>
<li><a href="https://dorpascal.com/hebrew-calendar/המרת-תאריך-לועזי-לעברי/">Date Conversion</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/shabbat-times/">Shabbat Times</a></li>
<li><a href="https://chromewebstore.google.com/detail/hebrew-calendar/hibmadldekamhiflhbaflaiafdbigihe">Chrome Extension</a></li>
<li><a href="https://microsoftedge.microsoft.com/addons/detail/hebrew-calendar/bjmfdgmpcnkkoekkfmobjjfgpfjabbal">Edge Extension</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/privacy-policy">Privacy Policy</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/he/">לעברית</a></li>
</ul>
</nav>
<div id="clock"></div>
<div id="date-display"></div>
<h1>Hebrew Calendar</h1>
<div id="parasha-hashavua"></div>
<nav id="menu"></nav>
<ul>
<li><a href="#date-calculation-explanation">Explanation of Calculations</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/המרת-תאריך-לועזי-לעברי/">Date Conversion</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/shabbat-times/">Shabbat Times</a></li>
<li><a href="https://chromewebstore.google.com/detail/hebrew-calendar/hibmadldekamhiflhbaflaiafdbigihe">Chrome Extension</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/privacy-policy">Privacy Policy</a></li>
<li><a href="https://dorpascal.com/hebrew-calendar/he/">לעברית</a></li>
</ul>
</nav>
</header>
<main>
<div class="toggle-container">
<label>
<input type="checkbox" id="toggle-digits" onchange="toggleDigits()"> Show numbers in Hebrew letters
</label>
</div>
<div class="modal" id="modal">
<div class="modal-content">
<span class="close">×</span>
<h2>New Chrome Extension!</h2>
<p>Check out my new Chrome extension for Hebrew dates and more!</p>
<img src="chrome-preview.png" alt="Chrome Extension Preview"
style="width: 100%; max-width: 400px; margin: 20px auto; display: block;">
<a id="chrome-button" href="https://chromewebstore.google.com/detail/hebrew-calendar/hibmadldekamhiflhbaflaiafdbigihe" target="_blank">Get it now on Chrome Web Store</a>
</div>
</div>
<div class="controls">
<button onclick="changeMonth(-1)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-chevron-left" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z" />
</svg>
Previous Month
</button>
<h2 id="current-month"></h2>
<button onclick="changeMonth(1)">
Next Month
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-chevron-right" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" />
</svg>
</button>
</div>
<div id="calendar"></div>
<section id="date-calculation-explanation" class="explanation">
<h2>How is the Hebrew Date Calculated?</h2>
<p>Our calendar uses advanced technology to accurately display the Hebrew date. Here are some key points
about how it works:</p>
<ul>
<h3>Date Conversion</h3>
<li>We use the browser's built-in system to convert Gregorian (secular) dates to Hebrew dates.</li>
<li>This ensures high accuracy and takes into account all the complexities of the Hebrew calendar.</li>
</ul>
<ul>
<h3>Hebrew Calendar Characteristics</h3>
<li>The Hebrew calendar is a lunisolar calendar, based on both lunar and solar cycles.</li>
<li>The Hebrew day begins at sunset, unlike the Gregorian day which starts at midnight.</li>
<li>Hebrew years are counted from the creation of the world according to Jewish tradition.</li>
<li>The Hebrew calendar includes leap months instead of leap days.</li>
</ul>
<ul>
<h3>Customized Display</h3>
<li>We display Hebrew dates in the traditional format, including Hebrew letters for days and years.</li>
<li>You can choose between a regular number display and a traditional Hebrew letter display.</li>
</ul>
<p>Thanks to this combination of modern technology and tradition, we offer an accurate and user-friendly
Hebrew calendar.</p>
</section>
<section id="date-conversion" class="explanation">
<h2>Convert Gregorian Date to Hebrew Date</h2>
<p>Use the form below to convert a Gregorian date to a Hebrew date. Simply enter a date and click "Convert"
to get the corresponding Hebrew date.</p>
<form id="date-conversion-form">
<label for="gregorian-date">Gregorian Date:</label>
<input type="date" id="gregorian-date" required>
<button type="submit">Convert</button>
</form>
<div id="hebrew-date"></div>
</section>
</main>
<footer class="footer">
<p>Created by <a href="https://dorpascal.com">Dor Pascal</a></p>
<p>© 2024 Dor Pascal. All rights reserved.</p>
</footer>
<script>
const modal = document.getElementById('modal');
const closeBtn = document.querySelector('.close');
closeBtn.addEventListener('click', () => {
modal.style.display = 'none';
});
window.addEventListener('load', () => {
setTimeout(() => {
modal.style.display = 'block';
}, 50);
});
let currentDate = new Date();
let useHebrewLetters = true;
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const hebrewNumerals = ['', 'א׳', 'ב׳', 'ג׳', 'ד׳', 'ה', 'ו׳', 'ז׳', 'ח׳', 'ט׳', 'י׳',
'י״א', 'י״ב', 'י״ג', 'י״ד', 'ט״ו', 'ט״ז', 'י״ז', 'י״ח', 'י״ט', 'כ',
'כ״א', 'כ״ב', 'כ״ג', 'כ״ד', 'כ״ה', 'כ״ו', 'כ״ז', 'כ״ח', 'כ״ט', 'ל'];
const parshiot2024 = [
{ date: new Date(2024, 0, 6), name: 'Shemot' },
{ date: new Date(2024, 0, 13), name: 'Vaera' },
{ date: new Date(2024, 0, 20), name: 'Bo' },
{ date: new Date(2024, 0, 27), name: 'Beshalach' },
{ date: new Date(2024, 1, 3), name: 'Yitro' },
{ date: new Date(2024, 1, 10), name: 'Mishpatim' },
{ date: new Date(2024, 1, 17), name: 'Terumah' },
{ date: new Date(2024, 1, 24), name: 'Tetzaveh' },
{ date: new Date(2024, 2, 2), name: 'Ki Tisa' },
{ date: new Date(2024, 2, 9), name: 'Vayakhel' },
{ date: new Date(2024, 2, 16), name: 'Pekudei' },
{ date: new Date(2024, 2, 23), name: 'Vayikra' },
{ date: new Date(2024, 2, 30), name: 'Tzav' },
{ date: new Date(2024, 3, 6), name: 'Passover' },
{ date: new Date(2024, 3, 13), name: 'Shemini' },
{ date: new Date(2024, 3, 20), name: 'Tazria-Metzora' },
{ date: new Date(2024, 4, 4), name: 'Achrei Mot-Kedoshim' },
{ date: new Date(2024, 4, 11), name: 'Emor' },
{ date: new Date(2024, 4, 18), name: 'Behar' },
{ date: new Date(2024, 4, 25), name: 'Bechukotai' },
{ date: new Date(2024, 5, 1), name: 'Bamidbar' },
{ date: new Date(2024, 5, 8), name: 'Nasso' },
{ date: new Date(2024, 5, 15), name: 'Beha\'alotcha' },
{ date: new Date(2024, 5, 22), name: 'Shelach' },
{ date: new Date(2024, 5, 29), name: 'Korach' },
{ date: new Date(2024, 6, 6), name: 'Chukat' },
{ date: new Date(2024, 6, 13), name: 'Balak' },
{ date: new Date(2024, 6, 20), name: 'Pinchas' },
{ date: new Date(2024, 6, 27), name: 'Matot-Masei' },
{ date: new Date(2024, 7, 3), name: 'Devarim' },
{ date: new Date(2024, 7, 10), name: 'Vaetchanan' },
{ date: new Date(2024, 7, 17), name: 'Eikev' },
{ date: new Date(2024, 7, 24), name: 'Re\'eh' },
{ date: new Date(2024, 7, 31), name: 'Shoftim' },
{ date: new Date(2024, 8, 7), name: 'Ki Teitzei' },
{ date: new Date(2024, 8, 14), name: 'Ki Tavo' },
{ date: new Date(2024, 8, 21), name: 'Nitzavim-Vayeilech' },
{ date: new Date(2024, 8, 28), name: 'Rosh Hashanah' },
{ date: new Date(2024, 9, 5), name: 'Ha\'Azinu' },
{ date: new Date(2024, 9, 12), name: 'Sukkot' },
{ date: new Date(2024, 9, 19), name: 'Vezot Haberachah' },
{ date: new Date(2024, 9, 26), name: 'Bereshit' },
{ date: new Date(2024, 10, 2), name: 'Noach' },
{ date: new Date(2024, 10, 9), name: 'Lech-Lecha' },
{ date: new Date(2024, 10, 16), name: 'Vayera' },
{ date: new Date(2024, 10, 23), name: 'Chayei Sarah' },
{ date: new Date(2024, 10, 30), name: 'Toldot' },
{ date: new Date(2024, 11, 7), name: 'Vayetzei' },
{ date: new Date(2024, 11, 14), name: 'Vayishlach' },
{ date: new Date(2024, 11, 21), name: 'Vayeshev' },
{ date: new Date(2024, 11, 28), name: 'Miketz' }
];
function getHebrewDate(gregorianDate, useHebrewLetters = true) {
const options = { day: 'numeric', month: 'long', year: 'numeric' };
const formatter = new Intl.DateTimeFormat('he-IL-u-ca-hebrew', options);
const parts = formatter.formatToParts(gregorianDate);
let hebrewDate = '';
parts.forEach(part => {
if (part.type === 'day') {
hebrewDate += useHebrewLetters ? hebrewNumerals[parseInt(part.value)] : part.value;
} else if (part.type === 'month') {
hebrewDate += ' ' + part.value;
} else if (part.type === 'year') {
const year = parseInt(part.value.replace(/['\u05F3"״]/g, ""), 10);
hebrewDate += ' ' + convertToHebrewYear(year);
}
});
return hebrewDate.trim();
}
function convertToHebrewYear(numericYear) {
const hebrewNumerals = [
'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת'
];
const specialCases = {
15: 'ט״ו',
16: 'ט״ז'
};
let year = parseInt(numericYear) - 5000;
let result = 'ה׳';
let hundreds = Math.floor(year / 100);
year %= 100;
let tens = Math.floor(year / 10);
let ones = year % 10;
if (hundreds > 0) {
if (hundreds === 7) {
result += 'תש';
} else if (hundreds === 6) {
result += 'ש';
} else if (hundreds === 5) {
result += 'ה';
} else if (hundreds === 4) {
result += 'ד';
}
}
if (tens > 0) {
const tensMap = {
1: 'י', 2: 'כ', 3: 'ל', 4: 'מ', 5: 'נ', 6: 'ס', 7: 'ע', 8: 'פ', 9: 'צ'
};
result += tensMap[tens];
}
if (ones > 0) {
result += hebrewNumerals[ones - 1];
}
if (tens === 1 && (ones === 5 || ones === 6)) {
result = result.slice(0, -2) + specialCases[tens * 10 + ones];
} else {
if (result.length > 3) {
result = result.slice(0, -1) + '״' + result.slice(-1);
} else if (result.length > 2) {
result += '׳';
}
}
return result;
}
function updateClock() {
const now = new Date();
const timeString = now.toLocaleTimeString('en-US');
const dateString = now.toLocaleDateString('en-US');
const hebrewDateString = getHebrewDate(now, useHebrewLetters);
document.getElementById('clock').textContent = timeString;
document.getElementById('date-display').textContent = `${dateString} - ${hebrewDateString}`;
}
function renderCalendar() {
const calendarEl = document.getElementById('calendar');
calendarEl.innerHTML = '';
const year = currentDate.getFullYear();
const month = currentDate.getMonth();
const gregorianMonth = new Intl.DateTimeFormat('he-IL', { month: 'long', year: 'numeric' }).format(currentDate);
const hebrewMonth = currentDate.toLocaleDateString('he-IL-u-ca-hebrew', { month: 'long', year: 'numeric' }).split(' ')[0];
const hebrewYear = currentDate.toLocaleDateString('he-IL-u-ca-hebrew', { year: 'numeric' }).split(' ')[1];
document.getElementById('current-month').textContent = `${gregorianMonth.split(' ')[0]} / ${hebrewMonth} ${gregorianMonth.split(' ')[1]}`;
daysOfWeek.forEach(day => {
const dayHeader = document.createElement('div');
dayHeader.className = 'day day-header';
dayHeader.textContent = day;
calendarEl.appendChild(dayHeader);
});
const firstDay = new Date(year, month, 1);
const lastDay = new Date(year, month + 1, 0);
const today = new Date();
for (let i = firstDay.getDay(); i > 0; i--) {
const dayEl = createDayElement(new Date(year, month, -i + 1), true);
calendarEl.appendChild(dayEl);
}
for (let day = 1; day <= lastDay.getDate(); day++) {
const dayEl = createDayElement(new Date(year, month, day), false, today);
calendarEl.appendChild(dayEl);
}
const remainingSlots = 42 - calendarEl.children.length;
for (let day = 1; day <= remainingSlots; day++) {
const dayEl = createDayElement(new Date(year, month + 1, day), true);
calendarEl.appendChild(dayEl);
}
}
function createDayElement(date, isOtherMonth, today) {
const dayEl = document.createElement('div');
dayEl.className = 'day' + (isOtherMonth ? ' other-month' : '');
if (today && date.toDateString() === today.toDateString()) {
dayEl.classList.add('today');
}
const hebrewDate = getHebrewDate(date, useHebrewLetters).split(' ')[0];
dayEl.innerHTML = `
<div>${date.getDate()}</div>
<div class="hebrew-date">${hebrewDate}</div>
`;
const gregorianDate = date.getDate() + '/' + (date.getMonth() + 1);
const weeklyParasha = getParashatHashavua(date);
// if shapat add weekly parasha
if (date.getDay() === 6) {
const parashaEl = document.createElement('div');
parashaEl.className = 'parasha';
parashaEl.textContent = weeklyParasha;
dayEl.appendChild(parashaEl);
}
// if new hebrew month add its name
if (hebrewDate === 'א׳') {
const newMonthEl = document.createElement('div');
newMonthEl.className = 'new-month';
newMonthEl.textContent = date.toLocaleDateString('he-IL-u-ca-hebrew', { month: 'long' }).split(' ')[0];
dayEl.appendChild(newMonthEl);
}
else {
console.log(hebrewDate);
}
return dayEl;
}
function changeMonth(delta) {
currentDate.setMonth(currentDate.getMonth() + delta);
renderCalendar();
}
function toggleDigits() {
useHebrewLetters = !useHebrewLetters;
renderCalendar();
updateClock();
}
function toggleTheme() {
document.body.classList.toggle('dark-theme');
const isDarkTheme = document.body.classList.contains('dark-theme');
localStorage.setItem('theme', isDarkTheme ? 'dark' : 'light');
const themeToggle = document.querySelector('.theme-toggle');
themeToggle.textContent = isDarkTheme ? 'Light Mode' : 'Dark Mode';
// update page theme color
const metaThemeColor = document.querySelector('meta[name="theme-color"]');
metaThemeColor.setAttribute('content', isDarkTheme ? '#2c3e50' : '#3498db');
renderCalendar();
}
function getParashatHashavua(hebrewDate = null) {
let now;
if (hebrewDate) {
// Convert Hebrew date to Gregorian date
now = new Date(hebrewDate.toLocaleDateString('en-US', { calendar: 'gregory' }));
} else {
now = new Date();
}
const nextWeek = new Date(now);
nextWeek.setDate(now.getDate() - 7); // Move before due to offset
for (let i = parshiot2024.length - 1; i >= 0; i--) {
if (nextWeek >= parshiot2024[i].date) {
return parshiot2024[i].name;
}
}
return parshiot2024[0].name;
}
function displayParashatHashavua() {
const parasha = getParashatHashavua();
const parashaElement = document.getElementById('parasha-hashavua');
parashaElement.textContent = `Weekly Torah Portion: ${parasha}`;
}
function loadPreferences() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.body.classList.add('dark-theme');
document.querySelector('.theme-toggle').textContent = 'Light Mode';
}
const savedUseDigits = localStorage.getItem('useDigits');
if (savedUseDigits !== null) {
useHebrewLetters = savedUseDigits != 'true';
document.getElementById('toggle-digits').checked = useHebrewLetters;
}
}
// Date conversion form handler
document.getElementById('date-conversion-form').addEventListener('submit', function (event) {
event.preventDefault();
const gregorianDate = new Date(document.getElementById('gregorian-date').value);
const hebrewDate = getHebrewDate(gregorianDate, useHebrewLetters);
document.getElementById('hebrew-date').textContent = `The Hebrew date is: ${hebrewDate}`;
});
window.onload = function () {
loadPreferences();
renderCalendar();
updateClock();
displayParashatHashavua();
setInterval(updateClock, 1000);
window.addEventListener('resize', renderCalendar);
};
function toggleMobileMenu() {
const mobileMenu = document.getElementById('mobile-menu');
mobileMenu.classList.toggle('active');
}
document.getElementById('menu-toggle').addEventListener('click', toggleMobileMenu);
// Close menu when clicking outside
document.addEventListener('click', function(event) {
const mobileMenu = document.getElementById('mobile-menu');
const menuToggle = document.getElementById('menu-toggle');
if (!mobileMenu.contains(event.target) && event.target !== menuToggle) {
mobileMenu.classList.remove('active');
}
});
</script>
</body>
</html>