@@ -607,9 +607,11 @@ <h2>המרת תאריך לועזי לעברי</h2>
607
607
608
608
const year = currentDate . getFullYear ( ) ;
609
609
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 ] ;
610
613
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 ] } ` ;
613
615
const isSmallScreen = window . innerWidth <= 480 ;
614
616
const dayNames = isSmallScreen ? daysOfWeekShort : daysOfWeek ;
615
617
@@ -677,6 +679,7 @@ <h2>המרת תאריך לועזי לעברי</h2>
677
679
updateClock ( ) ;
678
680
679
681
682
+
680
683
const parshiot2024 = [
681
684
{ date : new Date ( 2024 , 0 , 6 ) , name : 'שְׁמוֹת' } ,
682
685
{ date : new Date ( 2024 , 0 , 13 ) , name : 'וָאֵרָא' } ,
@@ -729,15 +732,18 @@ <h2>המרת תאריך לועזי לעברי</h2>
729
732
{ date : new Date ( 2024 , 11 , 28 ) , name : 'מִקֵּץ' }
730
733
] ;
731
734
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
+ }
737
744
}
745
+ return parshiot2024 [ 0 ] . name ;
738
746
}
739
- return parshiot2024 [ 0 ] . name ; // Default to the first parasha if no match found
740
- }
741
747
742
748
function displayParashatHashavua ( ) {
743
749
const parasha = getParashatHashavua ( ) ;
0 commit comments