Skip to content

Commit 7227d7d

Browse files
committed
Fix parashat hashavua and add hebrew month names
1 parent 1e0b89a commit 7227d7d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

he/index.html

+15-9
Original file line numberDiff line numberDiff line change
@@ -607,9 +607,11 @@ <h2>המרת תאריך לועזי לעברי</h2>
607607

608608
const year = currentDate.getFullYear();
609609
const month = currentDate.getMonth();
610+
const gregorianMonth = new Intl.DateTimeFormat('he-IL', { month: 'long', year: 'numeric' }).format(currentDate);
611+
const hebrewMonth = currentDate.toLocaleDateString('he-IL-u-ca-hebrew', { month: 'long', year: 'numeric' }).split(' ')[0];
612+
const hebrewYear = currentDate.toLocaleDateString('he-IL-u-ca-hebrew', { year: 'numeric' }).split(' ')[1];
610613

611-
document.getElementById('current-month').textContent = new Intl.DateTimeFormat('he-IL', { month: 'long', year: 'numeric' }).format(currentDate);
612-
614+
document.getElementById('current-month').textContent = `${gregorianMonth.split(' ')[0]} / ${hebrewMonth} ${gregorianMonth.split(' ')[1]}`;
613615
const isSmallScreen = window.innerWidth <= 480;
614616
const dayNames = isSmallScreen ? daysOfWeekShort : daysOfWeek;
615617

@@ -677,6 +679,7 @@ <h2>המרת תאריך לועזי לעברי</h2>
677679
updateClock();
678680

679681

682+
680683
const parshiot2024 = [
681684
{ date: new Date(2024, 0, 6), name: 'שְׁמוֹת' },
682685
{ date: new Date(2024, 0, 13), name: 'וָאֵרָא' },
@@ -729,15 +732,18 @@ <h2>המרת תאריך לועזי לעברי</h2>
729732
{ date: new Date(2024, 11, 28), name: 'מִקֵּץ' }
730733
];
731734

732-
function getParashatHashavua() {
733-
const now = new Date();
734-
for (let i = parshiot2024.length - 1; i >= 0; i--) {
735-
if (now >= parshiot2024[i].date) {
736-
return parshiot2024[i].name;
735+
function getParashatHashavua() {
736+
const now = new Date();
737+
const nextWeek = new Date();
738+
nextWeek.setDate(now.getDate() + 7); // Move 7 days ahead
739+
740+
for (let i = parshiot2024.length - 1; i >= 0; i--) {
741+
if (nextWeek >= parshiot2024[i].date) {
742+
return parshiot2024[i].name;
743+
}
737744
}
745+
return parshiot2024[0].name;
738746
}
739-
return parshiot2024[0].name; // Default to the first parasha if no match found
740-
}
741747

742748
function displayParashatHashavua() {
743749
const parasha = getParashatHashavua();

0 commit comments

Comments
 (0)