angular-moment icon indicating copy to clipboard operation
angular-moment copied to clipboard

`isSameOrBefore` is not a function

Open atefBB opened this issue 8 years ago • 2 comments

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?

atefBB avatar Apr 03 '17 10:04 atefBB

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.

shani7783 avatar Jun 07 '18 11:06 shani7783

Thanks @shani7783 !

atefBB avatar Jun 07 '18 12:06 atefBB