6

I have two variable

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

I want to compare whether these two times are equal or greater by using angular js, can anyone explain to me? How can I compare?

VVD
  • 178
  • 1
  • 9
user4758229
  • 249
  • 3
  • 7
  • 17

2 Answers2

3

Angular does not provide any such method. You would have to use native 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 the variables into $scope if you want to use them in the template.

VVD
  • 178
  • 1
  • 9
Neo
  • 4,550
  • 6
  • 34
  • 51
2

Angular has not providr utilities for Date Time

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

Oktaheta
  • 606
  • 5
  • 21