@@ -106,23 +106,45 @@ async function enrichDataWithMySQL(results, currentUserId = null) {
106106
107107 const totalCount = cheerMap [ post . id ] || 0 ;
108108 const specificInterestCount = ( cheererInterestMap [ post . id ] && cheererInterestMap [ post . id ] [ displayTopic ] ) || 0 ;
109-
110- // D-Day UI κ³μ°
109+ // D-Day UI κ³μ° (KST κ°μ 보μ , λΌμ΄λΈλ¬λ¦¬ μμ΄)
110+ // D-Day UI κ³μ° (KST κ°μ 보μ , λΌμ΄λΈλ¬λ¦¬ μμ΄)
111111 let dDay = "μμ" ;
112112 let isTodayEnd = false ;
113113
114114 if ( post . end_date ) {
115+ // π₯ νκ΅ νμ¬ μκ° λ§λ€κΈ° (KST)
115116 const now = new Date ( ) ;
116- const endDate = new Date ( post . end_date ) ;
117+ const nowKST = new Date ( now . getTime ( ) + 9 * 60 * 60 * 1000 ) ;
118+
119+ // π₯ end_date λ¬Έμμ΄μ KST κΈ°μ€μΌλ‘ μμ νμ±
120+ // μ: "2026-01-24 15:00" β "2026-01-24T15:00:00"
121+ let endStr = post . end_date ;
122+ if ( typeof endStr === "string" && endStr . includes ( " " ) ) {
123+ endStr = endStr . replace ( " " , "T" ) ;
124+ if ( endStr . length === 16 ) endStr += ":00" ; // μ΄ μμΌλ©΄ μΆκ°
125+ }
126+ const endDate = new Date ( endStr ) ;
117127
118128 // π΄ μ΄λ―Έ μκ°μ΄ μ§λ κ²½μ° β 무쑰건 λ§κ°
119- if ( endDate . getTime ( ) < now . getTime ( ) ) {
129+ if ( endDate . getTime ( ) < nowKST . getTime ( ) ) {
120130 dDay = "λ§κ°" ;
121131 isTodayEnd = false ;
122132 } else {
123- // μμ§ μ μ§λ κ²½μ° β λ μ§ λ¨μ D-Day κ³μ°
124- const todayMidnight = new Date ( now . getFullYear ( ) , now . getMonth ( ) , now . getDate ( ) ) . getTime ( ) ;
125- const endMidnight = new Date ( endDate . getFullYear ( ) , endDate . getMonth ( ) , endDate . getDate ( ) ) . getTime ( ) ;
133+ // λ μ§ λ¨μ D-Day κ³μ° (KST κΈ°μ€)
134+ const todayMidnight = new Date (
135+ nowKST . getFullYear ( ) ,
136+ nowKST . getMonth ( ) ,
137+ nowKST . getDate ( ) ,
138+ 0 , 0 , 0 , 0
139+ ) . getTime ( ) ;
140+
141+ const endMidnight = new Date (
142+ endDate . getFullYear ( ) ,
143+ endDate . getMonth ( ) ,
144+ endDate . getDate ( ) ,
145+ 0 , 0 , 0 , 0
146+ ) . getTime ( ) ;
147+
126148 const diffDays = Math . ceil ( ( endMidnight - todayMidnight ) / ( 1000 * 60 * 60 * 24 ) ) ;
127149
128150 if ( diffDays === 0 ) {
@@ -137,6 +159,7 @@ async function enrichDataWithMySQL(results, currentUserId = null) {
137159
138160
139161
162+
140163 return {
141164 id : post . id ,
142165 title : post . title ,
0 commit comments