/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/add-subtract.js |
@@ -0,0 +1,55 @@ |
import { get, set } from './get-set'; |
import { setMonth } from '../units/month'; |
import { createDuration } from '../duration/create'; |
import { deprecateSimple } from '../utils/deprecate'; |
import { hooks } from '../utils/hooks'; |
import absRound from '../utils/abs-round'; |
|
|
// TODO: remove 'name' arg after deprecation is removed |
function createAdder(direction, name) { |
return function (val, period) { |
var dur, tmp; |
//invert the arguments, but complain about it |
if (period !== null && !isNaN(+period)) { |
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + |
'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); |
tmp = val; val = period; period = tmp; |
} |
|
val = typeof val === 'string' ? +val : val; |
dur = createDuration(val, period); |
addSubtract(this, dur, direction); |
return this; |
}; |
} |
|
export function addSubtract (mom, duration, isAdding, updateOffset) { |
var milliseconds = duration._milliseconds, |
days = absRound(duration._days), |
months = absRound(duration._months); |
|
if (!mom.isValid()) { |
// No op |
return; |
} |
|
updateOffset = updateOffset == null ? true : updateOffset; |
|
if (milliseconds) { |
mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); |
} |
if (days) { |
set(mom, 'Date', get(mom, 'Date') + days * isAdding); |
} |
if (months) { |
setMonth(mom, get(mom, 'Month') + months * isAdding); |
} |
if (updateOffset) { |
hooks.updateOffset(mom, days || months); |
} |
} |
|
export var add = createAdder(1, 'add'); |
export var subtract = createAdder(-1, 'subtract'); |
|
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/calendar.js |
@@ -0,0 +1,26 @@ |
import { createLocal } from '../create/local'; |
import { cloneWithOffset } from '../units/offset'; |
import isFunction from '../utils/is-function'; |
import { hooks } from '../utils/hooks'; |
|
export function getCalendarFormat(myMoment, now) { |
var diff = myMoment.diff(now, 'days', true); |
return diff < -6 ? 'sameElse' : |
diff < -1 ? 'lastWeek' : |
diff < 0 ? 'lastDay' : |
diff < 1 ? 'sameDay' : |
diff < 2 ? 'nextDay' : |
diff < 7 ? 'nextWeek' : 'sameElse'; |
} |
|
export function calendar (time, formats) { |
// We want to compare the start of today, vs this. |
// Getting start-of-today depends on whether we're local/utc/offset or not. |
var now = time || createLocal(), |
sod = cloneWithOffset(now, this).startOf('day'), |
format = hooks.calendarFormat(this, sod) || 'sameElse'; |
|
var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); |
|
return this.format(output || this.localeData().calendar(format, this, createLocal(now))); |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/compare.js |
@@ -0,0 +1,59 @@ |
import { isMoment } from './constructor'; |
import { normalizeUnits } from '../units/aliases'; |
import { createLocal } from '../create/local'; |
import isUndefined from '../utils/is-undefined'; |
|
export function isAfter (input, units) { |
var localInput = isMoment(input) ? input : createLocal(input); |
if (!(this.isValid() && localInput.isValid())) { |
return false; |
} |
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); |
if (units === 'millisecond') { |
return this.valueOf() > localInput.valueOf(); |
} else { |
return localInput.valueOf() < this.clone().startOf(units).valueOf(); |
} |
} |
|
export function isBefore (input, units) { |
var localInput = isMoment(input) ? input : createLocal(input); |
if (!(this.isValid() && localInput.isValid())) { |
return false; |
} |
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); |
if (units === 'millisecond') { |
return this.valueOf() < localInput.valueOf(); |
} else { |
return this.clone().endOf(units).valueOf() < localInput.valueOf(); |
} |
} |
|
export function isBetween (from, to, units, inclusivity) { |
inclusivity = inclusivity || '()'; |
return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && |
(inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); |
} |
|
export function isSame (input, units) { |
var localInput = isMoment(input) ? input : createLocal(input), |
inputMs; |
if (!(this.isValid() && localInput.isValid())) { |
return false; |
} |
units = normalizeUnits(units || 'millisecond'); |
if (units === 'millisecond') { |
return this.valueOf() === localInput.valueOf(); |
} else { |
inputMs = localInput.valueOf(); |
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); |
} |
} |
|
export function isSameOrAfter (input, units) { |
return this.isSame(input, units) || this.isAfter(input,units); |
} |
|
export function isSameOrBefore (input, units) { |
return this.isSame(input, units) || this.isBefore(input,units); |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/constructor.js |
@@ -0,0 +1,77 @@ |
import { hooks } from '../utils/hooks'; |
import hasOwnProp from '../utils/has-own-prop'; |
import isUndefined from '../utils/is-undefined'; |
import getParsingFlags from '../create/parsing-flags'; |
|
// Plugins that add properties should also add the key here (null value), |
// so we can properly clone ourselves. |
var momentProperties = hooks.momentProperties = []; |
|
export function copyConfig(to, from) { |
var i, prop, val; |
|
if (!isUndefined(from._isAMomentObject)) { |
to._isAMomentObject = from._isAMomentObject; |
} |
if (!isUndefined(from._i)) { |
to._i = from._i; |
} |
if (!isUndefined(from._f)) { |
to._f = from._f; |
} |
if (!isUndefined(from._l)) { |
to._l = from._l; |
} |
if (!isUndefined(from._strict)) { |
to._strict = from._strict; |
} |
if (!isUndefined(from._tzm)) { |
to._tzm = from._tzm; |
} |
if (!isUndefined(from._isUTC)) { |
to._isUTC = from._isUTC; |
} |
if (!isUndefined(from._offset)) { |
to._offset = from._offset; |
} |
if (!isUndefined(from._pf)) { |
to._pf = getParsingFlags(from); |
} |
if (!isUndefined(from._locale)) { |
to._locale = from._locale; |
} |
|
if (momentProperties.length > 0) { |
for (i = 0; i < momentProperties.length; i++) { |
prop = momentProperties[i]; |
val = from[prop]; |
if (!isUndefined(val)) { |
to[prop] = val; |
} |
} |
} |
|
return to; |
} |
|
var updateInProgress = false; |
|
// Moment prototype object |
export function Moment(config) { |
copyConfig(this, config); |
this._d = new Date(config._d != null ? config._d.getTime() : NaN); |
if (!this.isValid()) { |
this._d = new Date(NaN); |
} |
// Prevent infinite loop in case updateOffset creates new moment |
// objects. |
if (updateInProgress === false) { |
updateInProgress = true; |
hooks.updateOffset(this); |
updateInProgress = false; |
} |
} |
|
export function isMoment (obj) { |
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/diff.js |
@@ -0,0 +1,62 @@ |
import absFloor from '../utils/abs-floor'; |
import { cloneWithOffset } from '../units/offset'; |
import { normalizeUnits } from '../units/aliases'; |
|
export function diff (input, units, asFloat) { |
var that, |
zoneDelta, |
delta, output; |
|
if (!this.isValid()) { |
return NaN; |
} |
|
that = cloneWithOffset(input, this); |
|
if (!that.isValid()) { |
return NaN; |
} |
|
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; |
|
units = normalizeUnits(units); |
|
if (units === 'year' || units === 'month' || units === 'quarter') { |
output = monthDiff(this, that); |
if (units === 'quarter') { |
output = output / 3; |
} else if (units === 'year') { |
output = output / 12; |
} |
} else { |
delta = this - that; |
output = units === 'second' ? delta / 1e3 : // 1000 |
units === 'minute' ? delta / 6e4 : // 1000 * 60 |
units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 |
units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst |
units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst |
delta; |
} |
return asFloat ? output : absFloor(output); |
} |
|
function monthDiff (a, b) { |
// difference in months |
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), |
// b is in (anchor - 1 month, anchor + 1 month) |
anchor = a.clone().add(wholeMonthDiff, 'months'), |
anchor2, adjust; |
|
if (b - anchor < 0) { |
anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); |
// linear across the month |
adjust = (b - anchor) / (anchor - anchor2); |
} else { |
anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); |
// linear across the month |
adjust = (b - anchor) / (anchor2 - anchor); |
} |
|
//check for negative zero, return zero if negative zero |
return -(wholeMonthDiff + adjust) || 0; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/format.js |
@@ -0,0 +1,57 @@ |
import { formatMoment } from '../format/format'; |
import { hooks } from '../utils/hooks'; |
import isFunction from '../utils/is-function'; |
|
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; |
hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; |
|
export function toString () { |
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); |
} |
|
export function toISOString() { |
if (!this.isValid()) { |
return null; |
} |
var m = this.clone().utc(); |
if (m.year() < 0 || m.year() > 9999) { |
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); |
} |
if (isFunction(Date.prototype.toISOString)) { |
// native implementation is ~50x faster, use it when we can |
return this.toDate().toISOString(); |
} |
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); |
} |
|
/** |
* Return a human readable representation of a moment that can |
* also be evaluated to get a new moment which is the same |
* |
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects |
*/ |
export function inspect () { |
if (!this.isValid()) { |
return 'moment.invalid(/* ' + this._i + ' */)'; |
} |
var func = 'moment'; |
var zone = ''; |
if (!this.isLocal()) { |
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; |
zone = 'Z'; |
} |
var prefix = '[' + func + '("]'; |
var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; |
var datetime = '-MM-DD[T]HH:mm:ss.SSS'; |
var suffix = zone + '[")]'; |
|
return this.format(prefix + year + datetime + suffix); |
} |
|
export function format (inputString) { |
if (!inputString) { |
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; |
} |
var output = formatMoment(this, inputString); |
return this.localeData().postformat(output); |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/get-set.js |
@@ -0,0 +1,55 @@ |
import { normalizeUnits, normalizeObjectUnits } from '../units/aliases'; |
import { getPrioritizedUnits } from '../units/priorities'; |
import { hooks } from '../utils/hooks'; |
import isFunction from '../utils/is-function'; |
|
|
export function makeGetSet (unit, keepTime) { |
return function (value) { |
if (value != null) { |
set(this, unit, value); |
hooks.updateOffset(this, keepTime); |
return this; |
} else { |
return get(this, unit); |
} |
}; |
} |
|
export function get (mom, unit) { |
return mom.isValid() ? |
mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; |
} |
|
export function set (mom, unit, value) { |
if (mom.isValid()) { |
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); |
} |
} |
|
// MOMENTS |
|
export function stringGet (units) { |
units = normalizeUnits(units); |
if (isFunction(this[units])) { |
return this[units](); |
} |
return this; |
} |
|
|
export function stringSet (units, value) { |
if (typeof units === 'object') { |
units = normalizeObjectUnits(units); |
var prioritized = getPrioritizedUnits(units); |
for (var i = 0; i < prioritized.length; i++) { |
this[prioritized[i].unit](units[prioritized[i].unit]); |
} |
} else { |
units = normalizeUnits(units); |
if (isFunction(this[units])) { |
return this[units](value); |
} |
} |
return this; |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/min-max.js |
@@ -0,0 +1,63 @@ |
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); |
} |
/pack-rat/003_pack_rat/pack-rat/bower_components/moment/src/lib/moment/prototype.js |
@@ -0,0 +1,150 @@ |
import { Moment } from './constructor'; |
|
var proto = Moment.prototype; |
|
import { add, subtract } from './add-subtract'; |
import { calendar, getCalendarFormat } from './calendar'; |
import { clone } from './clone'; |
import { isBefore, isBetween, isSame, isAfter, isSameOrAfter, isSameOrBefore } from './compare'; |
import { diff } from './diff'; |
import { format, toString, toISOString, inspect } from './format'; |
import { from, fromNow } from './from'; |
import { to, toNow } from './to'; |
import { stringGet, stringSet } from './get-set'; |
import { locale, localeData, lang } from './locale'; |
import { prototypeMin, prototypeMax } from './min-max'; |
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.clone = clone; |
proto.diff = diff; |
proto.endOf = endOf; |
proto.format = format; |
proto.from = from; |
proto.fromNow = fromNow; |
proto.to = to; |
proto.toNow = toNow; |
proto.get = stringGet; |
proto.invalidAt = invalidAt; |
proto.isAfter = isAfter; |
proto.isBefore = isBefore; |
proto.isBetween = isBetween; |
proto.isSame = isSame; |
proto.isSameOrAfter = isSameOrAfter; |
proto.isSameOrBefore = isSameOrBefore; |
proto.isValid = isValid; |
proto.lang = lang; |
proto.locale = locale; |
proto.localeData = localeData; |
proto.max = prototypeMax; |
proto.min = prototypeMin; |
proto.parsingFlags = parsingFlags; |
proto.set = stringSet; |
proto.startOf = startOf; |
proto.subtract = subtract; |
proto.toArray = toArray; |
proto.toObject = toObject; |
proto.toDate = toDate; |
proto.toISOString = toISOString; |
proto.inspect = inspect; |
proto.toJSON = toJSON; |
proto.toString = toString; |
proto.unix = unix; |
proto.valueOf = valueOf; |
proto.creationData = creationData; |
|
// Year |
import { getSetYear, getIsLeapYear } from '../units/year'; |
proto.year = getSetYear; |
proto.isLeapYear = getIsLeapYear; |
|
// Week Year |
import { getSetWeekYear, getSetISOWeekYear, getWeeksInYear, getISOWeeksInYear } from '../units/week-year'; |
proto.weekYear = getSetWeekYear; |
proto.isoWeekYear = getSetISOWeekYear; |
|
// Quarter |
import { getSetQuarter } from '../units/quarter'; |
proto.quarter = proto.quarters = getSetQuarter; |
|
// Month |
import { getSetMonth, getDaysInMonth } from '../units/month'; |
proto.month = getSetMonth; |
proto.daysInMonth = getDaysInMonth; |
|
// Week |
import { getSetWeek, getSetISOWeek } from '../units/week'; |
proto.week = proto.weeks = getSetWeek; |
proto.isoWeek = proto.isoWeeks = getSetISOWeek; |
proto.weeksInYear = getWeeksInYear; |
proto.isoWeeksInYear = getISOWeeksInYear; |
|
// Day |
import { getSetDayOfMonth } from '../units/day-of-month'; |
import { getSetDayOfWeek, getSetISODayOfWeek, getSetLocaleDayOfWeek } from '../units/day-of-week'; |
import { getSetDayOfYear } from '../units/day-of-year'; |
proto.date = getSetDayOfMonth; |
proto.day = proto.days = getSetDayOfWeek; |
proto.weekday = getSetLocaleDayOfWeek; |
proto.isoWeekday = getSetISODayOfWeek; |
proto.dayOfYear = getSetDayOfYear; |
|
// Hour |
import { getSetHour } from '../units/hour'; |
proto.hour = proto.hours = getSetHour; |
|
// Minute |
import { getSetMinute } from '../units/minute'; |
proto.minute = proto.minutes = getSetMinute; |
|
// Second |
import { getSetSecond } from '../units/second'; |
proto.second = proto.seconds = getSetSecond; |
|
// Millisecond |
import { getSetMillisecond } from '../units/millisecond'; |
proto.millisecond = proto.milliseconds = getSetMillisecond; |
|
// Offset |
import { |
getSetOffset, |
setOffsetToUTC, |
setOffsetToLocal, |
setOffsetToParsedOffset, |
hasAlignedHourOffset, |
isDaylightSavingTime, |
isDaylightSavingTimeShifted, |
getSetZone, |
isLocal, |
isUtcOffset, |
isUtc |
} from '../units/offset'; |
proto.utcOffset = getSetOffset; |
proto.utc = setOffsetToUTC; |
proto.local = setOffsetToLocal; |
proto.parseZone = setOffsetToParsedOffset; |
proto.hasAlignedHourOffset = hasAlignedHourOffset; |
proto.isDST = isDaylightSavingTime; |
proto.isLocal = isLocal; |
proto.isUtcOffset = isUtcOffset; |
proto.isUtc = isUtc; |
proto.isUTC = isUtc; |
|
// Timezone |
import { getZoneAbbr, getZoneName } from '../units/timezone'; |
proto.zoneAbbr = getZoneAbbr; |
proto.zoneName = getZoneName; |
|
// Deprecations |
import { deprecate } from '../utils/deprecate'; |
proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); |
proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); |
proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); |
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); |
proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); |
|
export default proto; |