Skip to content

Commit

Permalink
Merge pull request #1 from AKHILREDDY1636/fix_#6143
Browse files Browse the repository at this point in the history
fix for moment#6143 - moment.max doesn't check the first argument to be val…
  • Loading branch information
AKHILREDDY1636 committed Apr 2, 2024
2 parents 18aba13 + bb632e7 commit 55f21bb
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/lib/moment/min-max.js
Expand Up @@ -4,16 +4,16 @@ import { createLocal } from '../create/local';
import { createInvalid } from '../create/valid';

export var prototypeMin = deprecate(
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
),
}
),
prototypeMax = deprecate(
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
Expand All @@ -39,10 +39,13 @@ function pickBy(fn, moments) {
if (!moments.length) {
return createLocal();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
res = NaN;
if (moments[0].isValid()) {
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
}
}
}
return res;
Expand Down

0 comments on commit 55f21bb

Please sign in to comment.