- Release July 20, 2016
## New Features
-* [#3233](http://github.com/moment/moment/pull/3233) Introduce month.isFormat for format/standalone discovery
-* [#2848](http://github.com/moment/moment/pull/2848) Allow user to get/set the rounding method used when calculating relative time
-* [#3112](http://github.com/moment/moment/pull/3112) optimize configFromStringAndFormat
-* [#3147](http://github.com/moment/moment/pull/3147) Call calendar format function with moment context
-* [#3160](http://github.com/moment/moment/pull/3160) deprecate isDSTShifted
-* [#3175](http://github.com/moment/moment/pull/3175) make moment calendar extensible with ad-hoc options
-* [#3191](http://github.com/moment/moment/pull/3191) toDate returns a copy of the internal date object
-* [#3192](http://github.com/moment/moment/pull/3192) Adding support for rollup import.
-* [#3238](http://github.com/moment/moment/pull/3238) Handle empty object and empty array for creation as now
-* [#3082](http://github.com/moment/moment/pull/3082) Use relative AMD moment dependency
+* [#3233](https://github.com/moment/moment/pull/3233) Introduce month.isFormat for format/standalone discovery
+* [#2848](https://github.com/moment/moment/pull/2848) Allow user to get/set the rounding method used when calculating relative time
+* [#3112](https://github.com/moment/moment/pull/3112) optimize configFromStringAndFormat
+* [#3147](https://github.com/moment/moment/pull/3147) Call calendar format function with moment context
+* [#3160](https://github.com/moment/moment/pull/3160) deprecate isDSTShifted
+* [#3175](https://github.com/moment/moment/pull/3175) make moment calendar extensible with ad-hoc options
+* [#3191](https://github.com/moment/moment/pull/3191) toDate returns a copy of the internal date object
+* [#3192](https://github.com/moment/moment/pull/3192) Adding support for rollup import.
+* [#3238](https://github.com/moment/moment/pull/3238) Handle empty object and empty array for creation as now
+* [#3082](https://github.com/moment/moment/pull/3082) Use relative AMD moment dependency
## Bugfixes
-* [#3241](http://github.com/moment/moment/pull/3241) Escape all 24 mixed pieces, not only first 12 in computeMonthsParse
-* [#3008](http://github.com/moment/moment/pull/3008) Object setter orders sets based on size of unit
-* [#3177](http://github.com/moment/moment/pull/3177) Bug Fix [#2704](http://github.com/moment/moment/pull/2704) - isoWeekday(String) inconsistent with isoWeekday(Number)
-* [#3230](http://github.com/moment/moment/pull/3230) fix passing date with format string to ignore format string
-* [#3232](http://github.com/moment/moment/pull/3232) Fix negative 0 in certain diff cases
-* [#3235](http://github.com/moment/moment/pull/3235) Use proper locale inheritance for the base locale, fixes [#3137](http://github.com/moment/moment/pull/3137)
+* [#3241](https://github.com/moment/moment/pull/3241) Escape all 24 mixed pieces, not only first 12 in computeMonthsParse
+* [#3008](https://github.com/moment/moment/pull/3008) Object setter orders sets based on size of unit
+* [#3177](https://github.com/moment/moment/pull/3177) Bug Fix [#2704](https://github.com/moment/moment/pull/2704) - isoWeekday(String) inconsistent with isoWeekday(Number)
+* [#3230](https://github.com/moment/moment/pull/3230) fix passing date with format string to ignore format string
+* [#3232](https://github.com/moment/moment/pull/3232) Fix negative 0 in certain diff cases
+* [#3235](https://github.com/moment/moment/pull/3235) Use proper locale inheritance for the base locale, fixes [#3137](https://github.com/moment/moment/pull/3137)
Plus es-do locale and locale bugfixes
"l10n",
"ender"
],
- "homepage": "http://github.com/moment/moment/",
+ "homepage": "https://github.com/moment/moment",
"authors": [{"name": "Tim Wood", "email": "washwithcare@gmail.com"}],
"license": "MIT",
"type": "component",
export function createDate (y, m, d, h, M, s, ms) {
- //can't just apply() to create a date:
- //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ // can't just apply() to create a date:
+ // https://stackoverflow.com/q/181348
var date = new Date(y, m, d, h, M, s, ms);
- //the date constructor remaps years 0-99 to 1900-1999
+ // the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
date.setFullYear(y);
}
export function createUTCDate (y) {
var date = new Date(Date.UTC.apply(null, arguments));
- //the Date.UTC function remaps years 0-99 to 1900-1999
+ // the Date.UTC function remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
return -fwdlw + fwd - 1;
}
-//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
+// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
export function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
var localWeekday = (7 + weekday - dow) % 7,
weekOffset = firstWeekOffset(year, dow, doy),
assert.equal(moment('gibberish', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'), 'Invalid date', 'doest throw for invalid strings');
assert.equal(moment('gibberish', []).format('MM DD YYYY'), 'Invalid date', 'doest throw for an empty array');
- //https://github.com/moment/moment/issues/1143
+ // https://github.com/moment/moment/issues/1143
assert.equal(moment(
'System Administrator and Database Assistant (7/1/2011), System Administrator and Database Assistant (7/1/2011), Database Coordinator (7/1/2011), Vice President (7/1/2011), System Administrator and Database Assistant (5/31/2012), Database Coordinator (7/1/2012), System Administrator and Database Assistant (7/1/2013)',
['MM/DD/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ'])
});
test('iso week formats', function (assert) {
- // http://en.wikipedia.org/wiki/ISO_week_date
+ // https://en.wikipedia.org/wiki/ISO_week_date
var cases = {
'2005-01-02': '2004-53',
'2005-12-31': '2005-52',
});
test('iso week year formats', function (assert) {
- // http://en.wikipedia.org/wiki/ISO_week_date
+ // https://en.wikipedia.org/wiki/ISO_week_date
var cases = {
'2005-01-02': '2004-53',
'2005-12-31': '2005-52',
});
test('week year formats', function (assert) {
- // http://en.wikipedia.org/wiki/ISO_week_date
+ // https://en.wikipedia.org/wiki/ISO_week_date
var cases = {
'2005-01-02': '2004-53',
'2005-12-31': '2005-52',
});
test('oddball permissiveness', function (assert) {
- //https://github.com/moment/moment/issues/1128
+ // https://github.com/moment/moment/issues/1128
assert.ok(moment('2010-10-3199', ['MM/DD/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']).isValid());
- //https://github.com/moment/moment/issues/1122
+ // https://github.com/moment/moment/issues/1122
assert.ok(moment('3:25', ['h:mma', 'hh:mma', 'H:mm', 'HH:mm']).isValid());
});
module('week year');
test('iso week year', function (assert) {
- // Some examples taken from http://en.wikipedia.org/wiki/ISO_week
+ // Some examples taken from https://en.wikipedia.org/wiki/ISO_week
assert.equal(moment([2005, 0, 1]).isoWeekYear(), 2004);
assert.equal(moment([2005, 0, 2]).isoWeekYear(), 2004);
assert.equal(moment([2005, 0, 3]).isoWeekYear(), 2005);
});
test('week year', function (assert) {
- // Some examples taken from http://en.wikipedia.org/wiki/ISO_week
+ // Some examples taken from https://en.wikipedia.org/wiki/ISO_week
moment.locale('dow: 1,doy: 4', {week: {dow: 1, doy: 4}}); // like iso
assert.equal(moment([2005, 0, 1]).weekYear(), 2004);
assert.equal(moment([2005, 0, 2]).weekYear(), 2004);
});
test('years with iso week 53', function (assert) {
- // Based on a table taken from http://en.wikipedia.org/wiki/ISO_week_date
+ // Based on a table taken from https://en.wikipedia.org/wiki/ISO_week_date
// (as downloaded on 2014-01-06) listing the 71 years in a 400-year cycle
// that have 53 weeks; in this case reflecting the 2000 based cycle
assert.equal(moment([2004, 11, 31]).isoWeek(), 53, 'Dec 31 2004 should be iso week 53');
});
test('count years with iso week 53', function (assert) {
- // Based on http://en.wikipedia.org/wiki/ISO_week_date (as seen on 2014-01-06)
+ // Based on https://en.wikipedia.org/wiki/ISO_week_date (as seen on 2014-01-06)
// stating that there are 71 years in a 400-year cycle that have 53 weeks;
// in this case reflecting the 2000 based cycle
var count = 0, i;
z;
// Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
+ // https://en.wikipedia.org/wiki/UTC+14:00
+ // https://en.wikipedia.org/wiki/UTC-12:00
for (z = -12; z <= 14; ++z) {
assert.equal(m.clone().zone(z * 60, true).format(fmt), m.format(fmt),
'local to zone(' + z + ':00) failed to keep local time');
z;
// Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
+ // https://en.wikipedia.org/wiki/UTC+14:00
+ // https://en.wikipedia.org/wiki/UTC-12:00
for (z = -12; z <= 14; ++z) {
assert.equal(m.clone().zone(z * 60).valueOf(), m.valueOf(),
'local to zone(' + z + ':00) failed to keep utc time (implicit)');
z;
// Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
+ // https://en.wikipedia.org/wiki/UTC+14:00
+ // https://en.wikipedia.org/wiki/UTC-12:00
for (z = -12; z <= 14; ++z) {
m.zone(z * 60);
z;
// Apparently there is -12:00 and +14:00
- // http://en.wikipedia.org/wiki/UTC+14:00
- // http://en.wikipedia.org/wiki/UTC-12:00
+ // https://en.wikipedia.org/wiki/UTC+14:00
+ // https://en.wikipedia.org/wiki/UTC-12:00
for (z = -12; z <= 14; ++z) {
m.zone(z * 60);