Reputation: 309
I want to calculate the time (in minutes) between two dates within the ngfor-loop in the html of a angular 2 component. I found this for angular 1 but this does not work
{{ item.startdate | amDifference : item.enddate : 'minutes' }}
"The pipe 'amDifference' could not be found..."
Did the function changed?
Upvotes: 2
Views: 6092
Reputation: 5720
You can use the angular2-moment package. This package provides a lot of different pipes for date operation/manipulation.
Here is an example for the amDifference
Pipe
@Component({
selector: 'app',
template: `
Expiration: {{nextDay | amDifference: today :'days' : true}} days`
})
Upvotes: 2