zettapi_client
Version:
Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.
16 lines (14 loc) • 509 B
JavaScript
app.filter("dateFilter", function () {
return function (items, key, from, to) {
if (typeof items === 'undefined') return;
if (!(items instanceof Array)) return;
from = typeof from === 'undefined' ? new Date('1999-01-01') : new Date(from);
to = typeof to === 'undefined' ? new Date() : new Date(to);
var result = [];
items.forEach(function (item) {
var value = new Date(item[key]);
if (value >= from && value <= to) result.push(item);
});
return result;
};
});