6

I am have two variable

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

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

Rafael Winterhalter
  • 40,511
  • 13
  • 102
  • 180
user4758229
  • 259
  • 3
  • 7
  • 16

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 do put the variables into $scope if you want to use in template.

Neo
  • 4,208
  • 6
  • 31
  • 45
2

Angular has not providr utilities for Date Time

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

Oktaheta
  • 548
  • 4
  • 19