Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!