Answer the question
In order to leave comments, you need to log in
Why is date not being compared in Angular.js?
Hello, I apologize for the possibly stupid question, but I'm not clear what the error is.
There is a JSON file from which I take the date. I wrote my own filter for it.
JSON entry example:
[
{
"productId": "milk",
"name": "Молоко",
"calories": "220 Ккал",
"price": 12,
"termin": 3,
"data": "25.05.2015"
},
<p>Дата изготовления: {{product.data | dateMark}} </p>
productApp.filter('dateMark', function(){
return function(srok){
var nowDate = new Date;
if (nowDate < srok){
return 'Круто';
} else
return 'НЕ круто';
}
});
Answer the question
In order to leave comments, you need to log in
Well, and the data string does not need to be converted to a date?
Date.parse for what is given.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question