0
I created a method that serves to take the difference of a certain date with today’s date. With the code I put, it returns true
. But when I use it within a computed value, it returns undefined
. And in the computed value I make a conditional that will anyway return true
but when I use it as an expression in Vue, it returns false.
<template>
<p v-if="dataqualquer">Hello World</p>
</template>
<script>
computed: {
dataqualquer() {
const data = this.dataDiferenca("05/02/2018")
data ? true : true
}
},
methods: {
dataDiferenca(data) {
// console.log(data)
// data = data.split("/")
// data.reverse();
// data = data.join("-")
// data = this.moment(data)
// console.log(data.diff())
// data.diff() < 0 ? false : true
data = data.split("/");
data.reverse();
data = data.join("-")
data = new Date(data)
const hoje = new Date()
data - hoje < 0 ? false : true
}
}
</script>