angular-moment
angular-moment copied to clipboard
`isSameOrBefore` is not a function
Hey, I used moment before (without AngularJs) and I used the isSameOrBefore() function and It works, but when I use Angular-moment module it raise this error : $scope.moment_var.isSameOrBefor is not a function.
Have you any ideas?
Hey, It's usually happened while you don't have really an object of moment, it's probably a string, You should first create an object of moment and then you can use it. for example: const myMomentDate: moment.Moment; let strDate: string = "2017-11-30T00:00:00" myMomentDate = moment.utc(strDate);
strDate is a string that represent date so the moment's functions are not exposed of course. Now for myMomentDate you can use isSameOrBefore() without getting any exception.
Thanks @shani7783 !