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

134
Views
Format date within template interpolation - vue js

I want to format the date within template {{date}}.

<div v-for="(data, index) in variable" :key="index">
{{data.date}}
</div>

where data.date is a string looks like 2014-09-09T18:30:00.000Z.

I want it in a human readable format.

I tried {{moment(data.visit_date).format("YYYY-MM-DD")}} but that throws error in console saying moment is not a function.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Can you define a method in your component and then use it like below?

<script>
import moment from 'moment';

export default {
    methods: {
        getFormattedDate(date) {
            return moment(date).format("YYYY-MM-DD")
        }
    }
}
</script>
<div v-for="(data, index) in variable" :key="index">
{{getFormattedDate(data.date)}}
</div>
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!