{"status":true,"data":[{"_id":"5addb7cbcd79850454bceb9f","no":12123,"orDate":"2010-01-01T00:00:00.000Z","oldness":"5"},{"_id":"5ae02a26de15e934ac70ee8f","no":11223,"orDate":"2004-01-01T00:00:00.000Z","oldness":"5"},{"_id":"5ae02a26de257934ac70ee8f","no":12311,"orDate":"1994-01-01T00:00:00.000Z","oldness":"5"}]}
This is my json response. I need to print only the year from orDate in vue js html.
How can I able to achieve the same.
My html code is
<div id="app">
<div v-for="aln in data">
{{aln._id}}
{{aln.no}}
{{aln.orDate}}
</div>
</div>
I orDate, I need to print only year from the date. If date is this 2010-01-01T00:00:00.000Z, I need to print 2010 only
My vue js code is
app = new Vue({
el: "#iapp",
data: {
data:[],
},
mounted: function() {
var vm = this;
$.ajax({
url: "http://localhost:4000/get/l/",
method: "GET",
dataType: "JSON",
success: function(e) {
if (e.status == 1) {
vm.data = e.data;
console.log(vm.data);
}
},
});
},
})