import { startOf, endOf } from './start-end-of';
import { valueOf, toDate, toArray, toObject, toJSON, unix } from './to-type';
import { isValid, parsingFlags, invalidAt } from './valid';
+import { creationData } from './creation-data';
proto.add = add;
proto.calendar = calendar;
proto.toString = toString;
proto.unix = unix;
proto.valueOf = valueOf;
+proto.creationData = creationData;
// Year
import { getSetYear, getIsLeapYear } from '../units/year';
--- /dev/null
+import { module, test } from '../qunit';
+import moment from '../../moment';
+
+module('creation data');
+
+test('valid date', function (assert) {
+ var dat = moment('1992-10-22');
+ var orig = dat.creationData();
+
+ assert.equal(dat.isValid(), true, '1992-10-22 is valid');
+ assert.equal(orig.input, '1992-10-22', 'original input is not correct.');
+ assert.equal(orig.format, 'YYYY-MM-DD', 'original format is defined.');
+ assert.equal(orig.locale._abbr, 'en', 'default locale is en');
+ assert.equal(orig.isUTC, false, 'not a UTC date');
+});
+
+test('valid date at fr locale', function (assert) {
+ var dat = moment('1992-10-22', 'YYYY-MM-DD', 'fr');
+ var orig = dat.creationData();
+
+ assert.equal(orig.locale._abbr, 'fr', 'locale is fr');
+});
+
+test('valid date with formats', function (assert) {
+ var dat = moment('29-06-1995', ['MM-DD-YYYY', 'DD-MM', 'DD-MM-YYYY']);
+ var orig = dat.creationData();
+
+ assert.equal(orig.format, 'DD-MM-YYYY', 'DD-MM-YYYY format is defined.');
+});