Angular date filter in range
Today, We want to share with you Angular date filter in range.
In this post we will show you Angular date filter in range, hear for Angular date filter in range we will give you demo and example for implement.
In this post, we will learn about Angular date filter in range with an example.
I want to some records display data in range of input date by two inputs of date. (AngularJS simple date filter in range by two inputs HTML elements.)
Filter a used on a specific date range.The date filter formats a date to a specified format display.
Syntax Date Filter
[php]
{{ date | date : format : timezone }}
[/php]
The date can be a simple date object Like as a milliseconds format, or a datetime string like “2019-02-08T06:05:05.035Z”
Example of ng-repeat filtering data by date range
index.html
[php]
Unique ID | LanName | isactive | Date |
{{data.languagesId}} | {{data.LanName}} | {{data.isactive}} | {{data.Date}} |
[/php]
script.js
[php]
var ng4app = angular.module(‘ndApp’,[]).controller(‘dateCtrl’, function($scope){
$scope.from = ’05/02/2019′;
$scope.to = ’05/04/2019′;
$scope.lanlist = [
{languagesId : ‘pp-12’, LanName : ‘laravel’, isactive : ‘Approved’, Date:’05/01/2019′ },
{languagesId : ‘pp-11’, LanName : ‘laravel’, isactive : ‘Canceled’, Date:’05/02/2019′ },
{languagesId : ‘pp-45’, LanName : ‘Javascript’, isactive : ‘Pending’, Date:’05/03/2019′ },
{languagesId : ‘pp-32’, LanName : ‘Thomas’, isactive : ‘Canceled’, Date:’05/04/2019′ },
{languagesId : ‘pp-01’, LanName : ‘Thomas’, isactive : ‘Pending’, Date:’05/05/2019′ },
{languagesId : ‘pp-09’, LanName : ‘Javascript’, isactive : ‘Approved’, Date:’05/06/2019′ },
{languagesId : ‘pp-23’, LanName : ‘vuejs’, isactive : ‘Requested’, Date:’05/07/2019′},
{languagesId : ‘pp-39’, LanName : ‘laravel’, isactive : ‘Pending’, Date:’05/08/2019′ }
];
})
.filter(‘dateRange’, function() {
return function(lanlists, from, to) {
return lanlists.filter(function(lanlist) {
return lanlist.Date >= from && lanlist.Date <= to;
});
}
})
[/php]
Angular 6 Example
Angular Latest My Previous Post With Source code Read more…..