Sfoglia il codice sorgente

use moment's utcOffset if possible

Adam Shaw 11 anni fa
parent
commit
8078425715
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      src/moment-ext.js

+ 6 - 1
src/moment-ext.js

@@ -98,7 +98,12 @@ function makeMoment(args, parseAsUTC, parseZone) {
 				mom._ambigZone = true;
 			}
 			else if (isSingleString) {
-				mom.zone(input); // if not a valid zone, will assign UTC
+				if (mom.utcOffset) {
+					mom.utcOffset(input); // if not a valid zone, will assign UTC
+				}
+				else {
+					mom.zone(input); // for moment-pre-2.9
+				}
 			}
 		}
 	}