moment's isSameOrBefore and isSameOrAfter return "is not a function" when called from a moment and passed a moment
The solution to this for me was to update to version 2.23.0 of Moment.js. I was mislead by my moment.d.ts
file which, for unknown reasons, was for version 2.11.1 of Moment.js instead as opposed to the version I had installed (version 2.9.0).
After the update, be sure to check in the browser's debugger's file explorer for the moment.js file and verify that it matches up with the one in your project - if it doesn't, at least in Firefox/Waterfox, try restarting the browser then pressing Ctrl + F5 on the page of your project you're having the issue with.
This has been a lesson for me to not put so much faith in the type-safety of TypeScript!
The isSameOrBefore
and isSameOrAfter
methods were introduced since version 2.11.0 : https://momentjs.com/docs/#/query/is-same-or-before/
You can upgrade the version and try this:
moment('2018-10-12 10:44:01').isSameOrBefore('2018-10-12 10:44:00')