]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
be smarter about deciding whether something is a date or not. fixes #1084 1091/head
authorIsaac Cambron <isaac@isaaccambron.com>
Sun, 15 Sep 2013 08:06:30 +0000 (04:06 -0400)
committerIsaac Cambron <isaac@isaaccambron.com>
Sun, 15 Sep 2013 08:06:30 +0000 (04:06 -0400)
moment.js

index 3a5ebd2fe711efb3cc37fa0fa5d6364a6a74e25e..4cd32db6986b1cdd5bbc1eb04567ef42fc54f4b5 100644 (file)
--- a/moment.js
+++ b/moment.js
         return Object.prototype.toString.call(input) === '[object Array]';
     }
 
+    function isDate(input) {
+        return Object.prototype.toString.call(input) === '[object Date]';
+    }
+
     // compare two arrays, return the number of differences
     function compareArrays(array1, array2) {
         var len = Math.min(array1.length, array2.length),
         } else if (isArray(input)) {
             config._a = input.slice(0);
             dateFromArray(config);
-        } else if (input instanceof Date) {
+        } else if (isDate(input)) {
             config._d = new Date(+input);
         } else if (typeof(input) === 'object') {
             dateFromObject(config);