PHP Classes

File: upload/themes/bb_simple/assets/moment/src/lib/moment/min-max.js

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/themes/bb_simple/assets/moment/src/lib/moment/min-max.js   Download  
File: upload/themes/bb_simple/assets/moment/src/lib/moment/min-max.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Bulletin Board
Manage and post messages in multi-user forums
Author: By
Last change:
Date: 3 years ago
Size: 1,852 bytes
 

Contents

Class file image Download
import { deprecate } from '../utils/deprecate'; import isArray from '../utils/is-array'; 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(); } } ); export var prototypeMax = deprecate( 'moment().max is deprecated, use moment.min 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(); } } ); // Pick a moment m from moments so that m[fn](other) is true for all // other. This relies on the function fn to be transitive. // // moments should either be an array of moment objects or an array, whose // first element is an array of moment objects. function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } 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]; } } return res; } // TODO: Use [].sort instead? export function min () { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); } export function max () { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); }