timezoneRegex = /\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g,
tokenCharacters = /(\\)?(MM?M?M?|dd?d?d|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|ZZ?|T)/g,
inputCharacters = /(\\)?([0-9]+|([a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+|([\+\-]\d\d:?\d\d))/gi,
+ isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
timezoneParseRegex = /([\+\-]|\d\d)/gi,
VERSION = "1.4.0",
shortcuts = 'Month|Date|Hours|Minutes|Seconds|Milliseconds'.split('|');
// version number
moment.version = VERSION;
+ // default format
+ moment.defaultFormat = isoFormat;
+
// language switching and caching
moment.lang = function (key, values) {
var i,
},
format : function (inputString) {
- return formatDate(this._d, inputString);
+ return inputString ? formatDate(this._d, inputString) :
+ formatDate(this._d, moment.defaultFormat);
},
add : function (input, val) {
test.ok(moment().zone() % 30 === 0, 'moment.fn.zone should be a multiple of 30 (was ' + moment().zone() + ')');
test.equal(moment().zone(), new Date().getTimezoneOffset(), 'zone should equal getTimezoneOffset');
test.done();
+ },
+
+ "default format" : function(test) {
+ test.expect(1);
+ var isoRegex = /\d{4}.\d\d.\d\dT\d\d.\d\d.\d\d[\+\-]\d\d:\d\d/;
+ test.ok(isoRegex.exec(moment().format()), "default format (" + moment().format() + ") should match ISO");
+ test.done();
}
};