¡He estado atrapado con este problema durante casi 4 horas! Intenté muchas soluciones en línea y las agoté todas, pero fue en vano. Agradecería cualquier forma de ayuda!

El día de la semana aparece incorrecto en la carga inicial, en realidad es martes: día incorrecto en la carga de la página inicial

Sin embargo, cuando me dirijo a una página diferente y regreso, es correcto. Día correcto después de enrutar a algún lugar y regresar

componente interno del lado del cliente

const checkDay = (dayIndex) ={amp}gt; { const currentDay = moment().weekday() return currentDay === dayIndex } 

retorno interior

 {amp}lt;div className="col-sm align-middle text-left align-days"{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(1) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Monday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;9:00 am - 7:00 pm{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(2) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Tuesday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;9:00 am - 7:00 pm{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(3) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Wednesday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;9:00 am - 7:00 pm{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(4) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Thursday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;9:00 am - 7:00 pm{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(5) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Friday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;9:00 am - 7:00 pm{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(6) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Saturday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;10:00 am - 5:00 pm{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;div className={`py-1 row ${checkDay(0) ? "today" : ""}`}{amp}gt;{amp}lt;span className="col-md-5 col-xs-6"{amp}gt;Sunday{amp}lt;/span{amp}gt;{amp}lt;span className="col-md-7 col-xs-6"{amp}gt;Closed{amp}lt;/span{amp}gt;{amp}lt;/div{amp}gt; {amp}lt;/div{amp}gt;