How to compare time in Angular.js?

I have two variables

1)$scope.priviuosLevelCutoffTime like 12:00 2)data.cutOffTime(form json) like 13:00 

I want to compare this two times equal or large using anguler js, can anyone explain to me how I can compre?

+6
source share
2 answers

Angular does not provide such a method. You will have to use your own JS date objects.

 var date1 = Date.parse('01/01/1970 ' + $scope.priviuosLevelCutoffTime+':00') var date1 = Date.parse('01/01/1970 ' + data.cutOffTime+':00') //date1>date2 

You can put variables in $scope if you want to use in a template.

+3
source

Angular has no utilities for Date Time

You can use angular instead: - https://github.com/urish/angular-moment

+2
source

Source: https://habr.com/ru/post/987717/


All Articles