// date from string and format string
function makeDateFromStringAndFormat(config) {
+ if (config._f === moment.ISO_8601) {
+ makeDateFromString(config);
+ return;
+ }
+
config._a = [];
config._pf.empty = true;
// default format
moment.defaultFormat = isoFormat;
+ // constant that refers to the ISO standard
+ moment.ISO_8601 = 'ISO 8601';
+
// Plugins that add properties should also add the key here (null value),
// so we can properly clone ourselves.
moment.momentProperties = momentProperties;
test.equal(moment('01', ["MM", "DD"])._f, "MM", "Should use first valid format");
+ // pass an ISO date in the array of formats
+ function parseISO(string) {
+ return moment(string, ['YYYY', 'HH:mm', 'M', moment.ISO_8601]);
+ }
+ // those tests are broken because of the scoring system
+ // and the deprecation of createFromInputFallback
+ //test.equal(parseISO('1994').year(), 1994, 'iso: test parse year');
+ //test.equal(parseISO('17:15').format('HH:mm'), '17:15', 'iso: test parse HH:mm');
+ test.equal(parseISO('2012-06-01').format('YYYY-MM-DD'), '2012-06-01', 'iso: test parse iso');
+
test.done();
},