[Pkg-javascript-commits] [node-moment] 01/03: New upstream version 2.19.4+ds
Julien Puydt
julien.puydt at laposte.net
Sat Dec 16 11:25:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
jpuydt-guest pushed a commit to branch master
in repository node-moment.
commit 02497505280ac20a33d96e004da855ab448051f2
Author: Julien Puydt <julien.puydt at laposte.net>
Date: Sat Dec 16 12:03:12 2017 +0100
New upstream version 2.19.4+ds
---
CHANGELOG.md | 8 ++++++++
Moment.js.nuspec | 9 +++++----
component.json | 2 +-
meteor/package.js | 2 +-
min/moment-with-locales.js | 12 +++++++-----
min/tests.js | 35 +++++++++++++++++++++++++++++------
moment.d.ts | 6 ++++--
moment.js | 12 +++++++-----
package.json | 2 +-
src/lib/create/from-array.js | 6 ++++--
src/lib/units/day-of-month.js | 2 +-
src/moment.js | 4 ++--
src/test/moment/create.js | 30 ++++++++++++++++++++++++------
src/test/moment/zones.js | 5 +++++
typing-tests/moment-tests.ts | 2 ++
15 files changed, 101 insertions(+), 36 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4e9a7d..e2461bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,14 @@
Changelog
=========
+### 2.19.4 [See changelog](https://gist.github.com/marwahaha/d3b7b0ddf4bdae512244f16e8cc59efb)
+
+* Release Dec 10, 2017
+
+* [#4332](https://github.com/moment/moment/pull/4332) [bugfix] Fix weekday verification for UTC and offset days (fixes [#4227](https://github.com/moment/moment/pull/4227))
+* [#4336](https://github.com/moment/moment/pull/4336) [bugfix] Fix [#4334](https://github.com/moment/moment/pull/4334): Remove unused function call argument
+* [#4246](https://github.com/moment/moment/pull/4246) [misc] Add 'ss' relative time key to typescript definition
+
### 2.19.3 [See changelog](https://gist.github.com/marwahaha/3654006bc0c2e522451c08d12c0bfabf)
* Release Nov 29, 2017
diff --git a/Moment.js.nuspec b/Moment.js.nuspec
index a71d8e1..a38e099 100644
--- a/Moment.js.nuspec
+++ b/Moment.js.nuspec
@@ -2,15 +2,16 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Moment.js</id>
- <version>2.19.3</version>
+ <version>2.19.4</version>
<authors>Tim Wood, Iskren Chernev, Moment.js contributors</authors>
<owners>Cory Deppen, Iskren Chernev</owners>
<description>A lightweight JavaScript date library for parsing, manipulating, and formatting dates.</description>
<releaseNotes>
- * Release Nov 29, 2017
+ * Release Dec 10, 2017
- * [#4326](https://github.com/moment/moment/pull/4326) [bugfix] Fix for ReDOS vulnerability (see [#4163](https://github.com/moment/moment/issues/4163))
- * [#4289](https://github.com/moment/moment/pull/4289) [misc] Fix spelling and formatting for U.S. for es-us
+ * [#4332](https://github.com/moment/moment/pull/4332) [bugfix] Fix weekday verification for UTC and offset days (fixes [#4227](https://github.com/moment/moment/pull/4227))
+ * [#4336](https://github.com/moment/moment/pull/4336) [bugfix] Fix [#4334](https://github.com/moment/moment/pull/4334): Remove unused function call argument
+ * [#4246](https://github.com/moment/moment/pull/4246) [misc] Add 'ss' relative time key to typescript definition
</releaseNotes>
<projectUrl>http://momentjs.com/</projectUrl>
<iconUrl>http://pbs.twimg.com/profile_images/482670411402858496/Xrtdc94q_normal.png</iconUrl>
diff --git a/component.json b/component.json
index 4ce6043..d9c3b77 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
{
"name": "moment",
- "version": "2.19.3",
+ "version": "2.19.4",
"main": "moment.js",
"description": "Parse, validate, manipulate, and display dates in JavaScript.",
"files": [
diff --git a/meteor/package.js b/meteor/package.js
index 0b8b4e0..922d35c 100644
--- a/meteor/package.js
+++ b/meteor/package.js
@@ -6,7 +6,7 @@ var packageName = 'momentjs:moment'; // https://atmospherejs.com/momentjs/momen
Package.describe({
name: packageName,
summary: 'Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging',
- version: '2.19.3',
+ version: '2.19.4',
git: 'https://github.com/moment/moment.git'
});
diff --git a/min/moment-with-locales.js b/min/moment-with-locales.js
index 54550f5..574b770 100644
--- a/min/moment-with-locales.js
+++ b/min/moment-with-locales.js
@@ -2023,7 +2023,7 @@ function currentDateArray(config) {
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) {
- var i, date, input = [], currentDate, yearToUse;
+ var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
@@ -2073,6 +2073,8 @@ function configFromArray (config) {
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
+
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
@@ -2084,7 +2086,7 @@ function configFromArray (config) {
}
// check for mismatching day of week
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
+ if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
@@ -3660,7 +3662,7 @@ addRegexToken('Do', function (isStrict, locale) {
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0], 10);
+ array[DATE] = toInt(input.match(match1to2)[0]);
});
// MOMENTS
@@ -4472,12 +4474,12 @@ addParseToken('x', function (input, array, config) {
// Side effect imports
//! moment.js
-//! version : 2.19.3
+//! version : 2.19.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
-hooks.version = '2.19.3';
+hooks.version = '2.19.4';
setHookCallback(createLocal);
diff --git a/min/tests.js b/min/tests.js
index 2c593bb..4696e52 100644
--- a/min/tests.js
+++ b/min/tests.js
@@ -58627,6 +58627,30 @@ test('parsing iso week year/week/weekday', function (assert) {
assert.equal(moment.utc('2012-W01').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)');
});
+test('parsing weekdays verifies the day', function (assert) {
+ // string with format
+ assert.ok(!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is incorrect for the date');
+ assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date');
+});
+
+test('parsing weekday on utc dates verifies day acccording to utc time', function (assert) {
+ assert.ok(moment.utc('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
+});
+
+test('parsing weekday on local dates verifies day acccording to local time', function (assert) {
+ // this doesn't do much useful if you're not in the US or at least close to it
+ assert.ok(moment('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
+});
+
+test('parsing weekday on utc dates with specified offsets verifies day acccording to that offset', function (assert) {
+ assert.ok(moment.utc('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
+});
+
+test('parsing weekday on local dates with specified offsets verifies day acccording to that offset', function (assert) {
+ // if you're in the US, these times will all be sometime Sunday, but they shoud parse as Monday
+ assert.ok(moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
+});
+
test('parsing week year/week/weekday (dow 1, doy 4)', function (assert) {
moment.locale('dow:1,doy:4', {week: {dow: 1, doy: 4}});
@@ -59101,12 +59125,6 @@ test('k, kk', function (assert) {
}
});
-test('mismatching day-of-week and date', function (assert) {
- // string with format
- assert.ok(!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is incorrect for the date');
- assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date');
-});
-
})));
@@ -72413,4 +72431,9 @@ test('parse zone with a minutes unit abs less than 16 should retain minutes', fu
assert.equal(o.hour(), 0);
});
+test('parse zone with weekday on verifies day acccording to the offset', function (assert) {
+ test.expectedDeprecations();
+ assert.ok(moment.parseZone('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
+});
+
})));
diff --git a/moment.d.ts b/moment.d.ts
index 24667a3..cdca9da 100644
--- a/moment.d.ts
+++ b/moment.d.ts
@@ -2,7 +2,7 @@ declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSp
declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment;
declare namespace moment {
- type RelativeTimeKey = 's' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'M' | 'MM' | 'y' | 'yy';
+ type RelativeTimeKey = 's' | 'ss' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'M' | 'MM' | 'y' | 'yy';
type CalendarKey = 'sameDay' | 'nextDay' | 'lastDay' | 'nextWeek' | 'lastWeek' | 'sameElse' | string;
type LongDateFormatKey = 'LTS' | 'LT' | 'L' | 'LL' | 'LLL' | 'LLLL' | 'lts' | 'lt' | 'l' | 'll' | 'lll' | 'llll';
@@ -82,6 +82,7 @@ declare namespace moment {
future: RelativeTimeFuturePastVal;
past: RelativeTimeFuturePastVal;
s: RelativeTimeSpecVal;
+ ss: RelativeTimeSpecVal;
m: RelativeTimeSpecVal;
mm: RelativeTimeSpecVal;
h: RelativeTimeSpecVal;
@@ -215,6 +216,7 @@ declare namespace moment {
future: any;
past: any;
s: any;
+ ss: any;
m: any;
mm: any;
h: any;
@@ -408,7 +410,7 @@ declare namespace moment {
strict?: boolean;
}
- interface Moment extends Object{
+ interface Moment extends Object {
format(format?: string): string;
startOf(unitOfTime: unitOfTime.StartOf): Moment;
diff --git a/moment.js b/moment.js
index 9dd31d1..f10d709 100644
--- a/moment.js
+++ b/moment.js
@@ -1,5 +1,5 @@
//! moment.js
-//! version : 2.19.3
+//! version : 2.19.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
@@ -2029,7 +2029,7 @@ function currentDateArray(config) {
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) {
- var i, date, input = [], currentDate, yearToUse;
+ var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
@@ -2079,6 +2079,8 @@ function configFromArray (config) {
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
+
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
@@ -2090,7 +2092,7 @@ function configFromArray (config) {
}
// check for mismatching day of week
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
+ if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
@@ -3666,7 +3668,7 @@ addRegexToken('Do', function (isStrict, locale) {
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0], 10);
+ array[DATE] = toInt(input.match(match1to2)[0]);
});
// MOMENTS
@@ -4478,7 +4480,7 @@ addParseToken('x', function (input, array, config) {
// Side effect imports
-hooks.version = '2.19.3';
+hooks.version = '2.19.4';
setHookCallback(createLocal);
diff --git a/package.json b/package.json
index 46d3311..372efa7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "moment",
- "version": "2.19.3",
+ "version": "2.19.4",
"description": "Parse, validate, manipulate, and display dates",
"homepage": "http://momentjs.com",
"author": "Iskren Ivov Chernev <iskren.chernev at gmail.com> (https://github.com/ichernev)",
diff --git a/src/lib/create/from-array.js b/src/lib/create/from-array.js
index 7626c45..b5a0911 100644
--- a/src/lib/create/from-array.js
+++ b/src/lib/create/from-array.js
@@ -21,7 +21,7 @@ function currentDateArray(config) {
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
export function configFromArray (config) {
- var i, date, input = [], currentDate, yearToUse;
+ var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
@@ -71,6 +71,8 @@ export function configFromArray (config) {
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
+
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
@@ -82,7 +84,7 @@ export function configFromArray (config) {
}
// check for mismatching day of week
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
+ if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
diff --git a/src/lib/units/day-of-month.js b/src/lib/units/day-of-month.js
index 0253253..0e4a02e 100644
--- a/src/lib/units/day-of-month.js
+++ b/src/lib/units/day-of-month.js
@@ -31,7 +31,7 @@ addRegexToken('Do', function (isStrict, locale) {
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0], 10);
+ array[DATE] = toInt(input.match(match1to2)[0]);
});
// MOMENTS
diff --git a/src/moment.js b/src/moment.js
index 2b78152..c023962 100644
--- a/src/moment.js
+++ b/src/moment.js
@@ -1,12 +1,12 @@
//! moment.js
-//! version : 2.19.3
+//! version : 2.19.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
import { hooks as moment, setHookCallback } from './lib/utils/hooks';
-moment.version = '2.19.3';
+moment.version = '2.19.4';
import {
min,
diff --git a/src/test/moment/create.js b/src/test/moment/create.js
index 8a50eef..91fb3a9 100644
--- a/src/test/moment/create.js
+++ b/src/test/moment/create.js
@@ -750,6 +750,30 @@ test('parsing iso week year/week/weekday', function (assert) {
assert.equal(moment.utc('2012-W01').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)');
});
+test('parsing weekdays verifies the day', function (assert) {
+ // string with format
+ assert.ok(!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is incorrect for the date');
+ assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date');
+});
+
+test('parsing weekday on utc dates verifies day acccording to utc time', function (assert) {
+ assert.ok(moment.utc('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
+});
+
+test('parsing weekday on local dates verifies day acccording to local time', function (assert) {
+ // this doesn't do much useful if you're not in the US or at least close to it
+ assert.ok(moment('Mon 03:59', 'ddd HH:mm').isValid(), 'Monday 03:59');
+});
+
+test('parsing weekday on utc dates with specified offsets verifies day acccording to that offset', function (assert) {
+ assert.ok(moment.utc('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
+});
+
+test('parsing weekday on local dates with specified offsets verifies day acccording to that offset', function (assert) {
+ // if you're in the US, these times will all be sometime Sunday, but they shoud parse as Monday
+ assert.ok(moment('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
+});
+
test('parsing week year/week/weekday (dow 1, doy 4)', function (assert) {
moment.locale('dow:1,doy:4', {week: {dow: 1, doy: 4}});
@@ -1224,9 +1248,3 @@ test('k, kk', function (assert) {
}
});
-test('mismatching day-of-week and date', function (assert) {
- // string with format
- assert.ok(!moment('Wed 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is incorrect for the date');
- assert.ok(moment('Thu 08-10-2017', 'ddd MM-DD-YYYY').isValid(), 'because day of week is correct for the date');
-});
-
diff --git a/src/test/moment/zones.js b/src/test/moment/zones.js
index dbe9e29..a7e4f6c 100644
--- a/src/test/moment/zones.js
+++ b/src/test/moment/zones.js
@@ -499,3 +499,8 @@ test('parse zone with a minutes unit abs less than 16 should retain minutes', fu
assert.equal(o.zone(), -15);
assert.equal(o.hour(), 0);
});
+
+test('parse zone with weekday on verifies day acccording to the offset', function (assert) {
+ test.expectedDeprecations();
+ assert.ok(moment.parseZone('Mon 03:59 +12:00', 'ddd HH:mm Z', true).isValid(), 'Monday 03:59');
+});
diff --git a/typing-tests/moment-tests.ts b/typing-tests/moment-tests.ts
index af635ca..bafdf11 100644
--- a/typing-tests/moment-tests.ts
+++ b/typing-tests/moment-tests.ts
@@ -302,6 +302,7 @@ moment.locale('en', {
future: "in %s",
past: "%s ago",
s: "seconds",
+ ss: "%d seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
@@ -446,6 +447,7 @@ moment.locale('en', {
future: "in %s",
past: "%s ago",
s: "seconds",
+ ss: "%d seconds",
m: "a minute",
mm: "%d minutes",
h: "an hour",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-moment.git
More information about the Pkg-javascript-commits
mailing list