I have data from the server to display. I receive strings such as this: 2016-05-01
. I need to filter the data between two dates in that format. I have a function to parse the date as it is:
$scope.parseDate = function (date) {
return new Date(Date.parse(date));
}
In my html I display the date with this:
{{ parseDate(item.startDate) }}`
But in the browser, the result is: "2016-07-12T00:00:00.000Z"
.
I need the parse the string into the same format as from the server: 2016-05-01.
I need a simple filter function.
I don't want to use moment.js
. My backend platform is JavaScript.
Try this in your html :
{{item.startDate | date: 'MMM dd, yyyy'}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With