Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

47
Vistas
Hide EJS accordian elements within a certain date range

I am trying to hide an accordion element in EJS based on it being within a specific date range. I have 17 accordion elements which each represent each week in the NFL Season. Every Thursday of each week once the season starts I will need to hide the accordion element for that week.

So for example in week 1 of the NFL season, at 6pm on Thursday I need to hide that element until the remainder of the NFL season. Same for week 2, at 6pm on Thursday of week 2 of the season I need to hide that element until the remainder of the NFL season, and so on for each week.

I have already tried researching the topic but am not finding anything, I am not really asking for a code sample here more of a general direction or some ideas of how I can achieve this using EJS. Any suggestions at all would be great!

Dashboard.ejs modal

<div class="modal-body">
  <div id="accordion">
    <% for(let i = 1; i <= 17; i++){ %>
    <div class="card">
      <div class="card-header" id="heading-<%= i %>">
        <h5 class="mb-0">
          <button class="btn btn-link" data-toggle="collapse" data-target="#collapse-<%= i %>" aria-expanded="true"
            aria-controls="collapse-<%= i %>">
            Week <%= i %>
          </button>
        </h5>
      </div>

      <div id="collapse-<%= i %>" class="collapse" aria-labelledby="heading-<%= i %>" data-parent="#accordion">
        <div class="card-body">
          <form class="mt-3 mb-3" method="POST" action="/api/users/makePicks/<%= i %>">
            <% playingBullets.forEach((bullet) => { %>
            <div class="form-group">
              <label for="<%= `${user.name}-${bullet}` %>">
                Make your pick for bullet <%= `${bullet}` %>
              </label>
              <select class="form-control" name="<%= `${user.name}-${bullet}` %>" id="<%= `${user.name}-${bullet}` %>">
                <% teamsArr.forEach(team => { %>
                <option><%= team %></option>
                <% }) %>
              </select>
            </div>
            <% }); %>
            <button type="submit" class="btn btn-primary">Save changes</button>
          </form>
        </div>
      </div>
      <% }; %>
    </div>
  </div>
</div>
10 months ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos