How to subtract two angularjs date variables

后端 未结 7 1086
说谎
说谎 2020-12-01 21:53

I am fairly new to angularjs, but here it goes. I am able two dates through angularjs in the form dd/mm/yyyy, but what I need to do is somehow subtract the two

7条回答
  •  萌比男神i
    2020-12-01 22:18

    You can use angular-moment to calculate the difference, using the amDifference filter:

    Get the difference between two dates in milliseconds. Parameters are date, units and usePrecision. Date defaults to current date. Example:

    Difference: {{ dateFrom | amDifference : dateTo : 'days' }} days
    

提交回复
热议问题