// internal storage for language config files
languages = {},
+ // moment internal properties
+ momentProperties = {
+ _isAMomentObject: null,
+ _i : null,
+ _f : null,
+ _l : null,
+ _strict : null,
+ _isUTC : null,
+ _offset : null, // optional. Combine with _isUTC
+ _pf : null,
+ _lang : null // optional
+ },
+
// check for nodeJS
hasModule = (typeof module !== 'undefined' && module.exports && typeof require !== 'undefined'),
return a;
}
+ function cloneMoment(m) {
+ var result = {};
+ for (var i in m) {
+ if (m.hasOwnProperty(i) && momentProperties.hasOwnProperty(i)) {
+ result[i] = m[i];
+ }
+ }
+
+ return result;
+ }
+
function absRound(number) {
if (number < 0) {
return Math.ceil(number);
}
if (moment.isMoment(input)) {
- config = extend({}, input);
+ config = cloneMoment(input);
config._d = new Date(+input._d);
} else if (format) {
lang = undefined;
}
return makeMoment({
+ _isAMomentObject: true,
_i : input,
_f : format,
_l : lang,
// compare moment object
moment.isMoment = function (obj) {
- return obj instanceof Moment;
+ return obj instanceof Moment ||
+ (obj != null && obj.hasOwnProperty('_isAMomentObject'));
};
// for typechecking Duration objects