Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
Make a post disappear if the date is older than today

Currently, I'm doing a website which repertories events organized my friend's music label. But I've encountered a problem while trying to make an "archiving automation". Using that code below is not working. My "articles" are still visibles on the blog page.

Here's what I've tried (it's working with a v-if on my nuxt-link, but not with a v-show). The reason why I don't use a v-if is that my links are still clickable, but not visible.

<div
  class="article"
  v-for="article in articles"
  :key="article.slug"
  v-show="dateNow < article.eventDate">

Here's my condition in my JS (not important but I prefer to show you guys)

data() {
  return {
    dateNow: new Date().toISOString()
  };
},
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think the issue is in the formatting of the date.

new Date().toISOString()

this will format the date as a string. So the output value for ( >= ) operation will be incorrect. One solution is to turn the date into a timestamp by providing "+" before the date and then make the logical operation. ex:

+new Date()

or

new Date().getTime()

Or if you use a date library like "moment" you can use isSameOrAfter or isSameOrBefore APIs. https://momentjs.com/docs/#/query/is-same-or-after/

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda