Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

277
Vistas
How can I properly use moment inside of pug?

I'm trying to use moment to format a date in PUG. This is my code:

  table(style='width:50%', border='2')
      tr
        th Event Title
        th Date
        th Coin
        th Name
        th Description
      each event in data.body
        tr
          td(style='text-align: center') #{event.title['en']}
          td(style='text-align: center') #{moment(event.date_event).format('YYYY-MM-DD')}
          td(style='text-align: center') #{event.coins[0].symbol}
          td(style='text-align: center') #{event.coins[0].name}

I've tried looking for examples here but I couldn't make it work with the ones I found. PS: I have the library installed and imported to all my local app files already.

Can anyone help me with that?

Cheers

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

app.locals.moment = require('moment');

or

script(src='moment.min.js')
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda