Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

isSameOrBefore is not a function #287

Open
atefBB opened this issue Apr 3, 2017 · 2 comments
Open

isSameOrBefore is not a function #287

atefBB opened this issue Apr 3, 2017 · 2 comments

Comments

@atefBB
Copy link

atefBB commented Apr 3, 2017

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?

@shani7783
Copy link

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.

@atefBB
Copy link
Author

atefBB commented Jun 7, 2018

Thanks @shani7783 !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants