Skip to content

Commit

Permalink
Only check for nodejs (require) if moment is not globally accessible.
Browse files Browse the repository at this point in the history
Fix for usage with `momentjs` with `ember-cli`.
  • Loading branch information
MadMG committed Mar 4, 2015
1 parent d544e38 commit cb445b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion moment-jdateformatparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
}
}

if (typeof require !== 'undefined' && require !== null) {
if (typeof this.moment === 'undefined' && typeof require !== 'undefined' && require !== null) {
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { //Check if the environment is Node.js
hookMoment(require('moment')); //if it is, we have to require it different (without the surrounding Array)
} else {
Expand Down

0 comments on commit cb445b2

Please sign in to comment.