@barchart/portfolio-api-common 1.2.140 → 1.2.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -422,13 +422,13 @@ module.exports = (() => {
422
422
  data.periodRealized = currentSummary !== null ? currentSummary.period.realized : Decimal.ZERO;
423
423
  data.periodUnrealized = currentSummary !== null ? currentSummary.period.unrealized : Decimal.ZERO;
424
424
 
425
- data.periodGain = calculatePeriodGain(data.initiate, currentSummary, previousSummary1);
426
- data.periodGainPrevious = calculatePeriodGain(data.initiate, previousSummary1, previousSummary2);
427
- data.periodGainPrevious2 = calculatePeriodGain(data.initiate, previousSummary2, previousSummary3);
425
+ data.periodGain = calculatePeriodGain(position.instrument.type, data.initiate, currentSummary, previousSummary1);
426
+ data.periodGainPrevious = calculatePeriodGain(position.instrument.type, data.initiate, previousSummary1, previousSummary2);
427
+ data.periodGainPrevious2 = calculatePeriodGain(position.instrument.type, data.initiate, previousSummary2, previousSummary3);
428
428
 
429
- data.periodDivisor = calculatePeriodDivisor(data.initiate, currentSummary, previousSummary1);
430
- data.periodDivisorPrevious = calculatePeriodDivisor(data.initiate, previousSummary1, previousSummary2);
431
- data.periodDivisorPrevious2 = calculatePeriodDivisor(data.initiate, previousSummary2, previousSummary3);
429
+ data.periodDivisor = calculatePeriodDivisor(position.instrument.type, data.initiate, currentSummary, previousSummary1);
430
+ data.periodDivisorPrevious = calculatePeriodDivisor(position.instrument.type, data.initiate, previousSummary1, previousSummary2);
431
+ data.periodDivisorPrevious2 = calculatePeriodDivisor(position.instrument.type, data.initiate, previousSummary2, previousSummary3);
432
432
 
433
433
  if (snapshot.open.getIsZero()) {
434
434
  data.basisPrice = Decimal.ZERO;
@@ -540,7 +540,7 @@ module.exports = (() => {
540
540
  data.unrealized = unrealized;
541
541
  data.unrealizedChange = unrealizedChange;
542
542
 
543
- let periodGain = calculatePeriodGain(data.initiate, currentSummary, previousSummary, priceToUse);
543
+ let periodGain = calculatePeriodGain(position.instrument.type, data.initiate, currentSummary, previousSummary, priceToUse);
544
544
  let periodGainChange;
545
545
 
546
546
  if (data.periodGain !== null) {
@@ -585,10 +585,10 @@ module.exports = (() => {
585
585
  return direction || PositionDirection.LONG;
586
586
  }
587
587
 
588
- function calculatePeriodGain(direction, currentSummary, previousSummary, overridePrice) {
588
+ function calculatePeriodGain(type, direction, currentSummary, previousSummary, overridePrice) {
589
589
  let returnRef;
590
590
 
591
- if (currentSummary) {
591
+ if (currentSummary && type !== InstrumentType.CASH) {
592
592
  let startValue;
593
593
 
594
594
  if (previousSummary) {
@@ -617,10 +617,10 @@ module.exports = (() => {
617
617
  return returnRef;
618
618
  }
619
619
 
620
- function calculatePeriodDivisor(direction, currentSummary, previousSummary) {
620
+ function calculatePeriodDivisor(type, direction, currentSummary, previousSummary) {
621
621
  let returnRef;
622
622
 
623
- if (currentSummary) {
623
+ if (currentSummary && type !== InstrumentType.CASH) {
624
624
  let startValue;
625
625
 
626
626
  if (previousSummary) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.140",
3
+ "version": "1.2.141",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -3928,13 +3928,13 @@ module.exports = (() => {
3928
3928
  data.periodRealized = currentSummary !== null ? currentSummary.period.realized : Decimal.ZERO;
3929
3929
  data.periodUnrealized = currentSummary !== null ? currentSummary.period.unrealized : Decimal.ZERO;
3930
3930
 
3931
- data.periodGain = calculatePeriodGain(data.initiate, currentSummary, previousSummary1);
3932
- data.periodGainPrevious = calculatePeriodGain(data.initiate, previousSummary1, previousSummary2);
3933
- data.periodGainPrevious2 = calculatePeriodGain(data.initiate, previousSummary2, previousSummary3);
3931
+ data.periodGain = calculatePeriodGain(position.instrument.type, data.initiate, currentSummary, previousSummary1);
3932
+ data.periodGainPrevious = calculatePeriodGain(position.instrument.type, data.initiate, previousSummary1, previousSummary2);
3933
+ data.periodGainPrevious2 = calculatePeriodGain(position.instrument.type, data.initiate, previousSummary2, previousSummary3);
3934
3934
 
3935
- data.periodDivisor = calculatePeriodDivisor(data.initiate, currentSummary, previousSummary1);
3936
- data.periodDivisorPrevious = calculatePeriodDivisor(data.initiate, previousSummary1, previousSummary2);
3937
- data.periodDivisorPrevious2 = calculatePeriodDivisor(data.initiate, previousSummary2, previousSummary3);
3935
+ data.periodDivisor = calculatePeriodDivisor(position.instrument.type, data.initiate, currentSummary, previousSummary1);
3936
+ data.periodDivisorPrevious = calculatePeriodDivisor(position.instrument.type, data.initiate, previousSummary1, previousSummary2);
3937
+ data.periodDivisorPrevious2 = calculatePeriodDivisor(position.instrument.type, data.initiate, previousSummary2, previousSummary3);
3938
3938
 
3939
3939
  if (snapshot.open.getIsZero()) {
3940
3940
  data.basisPrice = Decimal.ZERO;
@@ -4046,7 +4046,7 @@ module.exports = (() => {
4046
4046
  data.unrealized = unrealized;
4047
4047
  data.unrealizedChange = unrealizedChange;
4048
4048
 
4049
- let periodGain = calculatePeriodGain(data.initiate, currentSummary, previousSummary, priceToUse);
4049
+ let periodGain = calculatePeriodGain(position.instrument.type, data.initiate, currentSummary, previousSummary, priceToUse);
4050
4050
  let periodGainChange;
4051
4051
 
4052
4052
  if (data.periodGain !== null) {
@@ -4091,10 +4091,10 @@ module.exports = (() => {
4091
4091
  return direction || PositionDirection.LONG;
4092
4092
  }
4093
4093
 
4094
- function calculatePeriodGain(direction, currentSummary, previousSummary, overridePrice) {
4094
+ function calculatePeriodGain(type, direction, currentSummary, previousSummary, overridePrice) {
4095
4095
  let returnRef;
4096
4096
 
4097
- if (currentSummary) {
4097
+ if (currentSummary && type !== InstrumentType.CASH) {
4098
4098
  let startValue;
4099
4099
 
4100
4100
  if (previousSummary) {
@@ -4123,10 +4123,10 @@ module.exports = (() => {
4123
4123
  return returnRef;
4124
4124
  }
4125
4125
 
4126
- function calculatePeriodDivisor(direction, currentSummary, previousSummary) {
4126
+ function calculatePeriodDivisor(type, direction, currentSummary, previousSummary) {
4127
4127
  let returnRef;
4128
4128
 
4129
- if (currentSummary) {
4129
+ if (currentSummary && type !== InstrumentType.CASH) {
4130
4130
  let startValue;
4131
4131
 
4132
4132
  if (previousSummary) {
@@ -13997,36 +13997,22 @@ moment.tz.load(require('./data/packed/latest.json'));
13997
13997
  function createDate (y, m, d, h, M, s, ms) {
13998
13998
  // can't just apply() to create a date:
13999
13999
  // https://stackoverflow.com/q/181348
14000
- var date;
14000
+ var date = new Date(y, m, d, h, M, s, ms);
14001
+
14001
14002
  // the date constructor remaps years 0-99 to 1900-1999
14002
- if (y < 100 && y >= 0) {
14003
- // preserve leap years using a full 400 year cycle, then reset
14004
- date = new Date(y + 400, m, d, h, M, s, ms);
14005
- if (isFinite(date.getFullYear())) {
14006
- date.setFullYear(y);
14007
- }
14008
- } else {
14009
- date = new Date(y, m, d, h, M, s, ms);
14003
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
14004
+ date.setFullYear(y);
14010
14005
  }
14011
-
14012
14006
  return date;
14013
14007
  }
14014
14008
 
14015
14009
  function createUTCDate (y) {
14016
- var date;
14010
+ var date = new Date(Date.UTC.apply(null, arguments));
14011
+
14017
14012
  // the Date.UTC function remaps years 0-99 to 1900-1999
14018
- if (y < 100 && y >= 0) {
14019
- var args = Array.prototype.slice.call(arguments);
14020
- // preserve leap years using a full 400 year cycle, then reset
14021
- args[0] = y + 400;
14022
- date = new Date(Date.UTC.apply(null, args));
14023
- if (isFinite(date.getUTCFullYear())) {
14024
- date.setUTCFullYear(y);
14025
- }
14026
- } else {
14027
- date = new Date(Date.UTC.apply(null, arguments));
14013
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
14014
+ date.setUTCFullYear(y);
14028
14015
  }
14029
-
14030
14016
  return date;
14031
14017
  }
14032
14018
 
@@ -14128,7 +14114,7 @@ moment.tz.load(require('./data/packed/latest.json'));
14128
14114
 
14129
14115
  var defaultLocaleWeek = {
14130
14116
  dow : 0, // Sunday is the first day of the week.
14131
- doy : 6 // The week that contains Jan 6th is the first week of the year.
14117
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
14132
14118
  };
14133
14119
 
14134
14120
  function localeFirstDayOfWeek () {
@@ -14237,28 +14223,25 @@ moment.tz.load(require('./data/packed/latest.json'));
14237
14223
  }
14238
14224
 
14239
14225
  // LOCALES
14240
- function shiftWeekdays (ws, n) {
14241
- return ws.slice(n, 7).concat(ws.slice(0, n));
14242
- }
14243
14226
 
14244
14227
  var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
14245
14228
  function localeWeekdays (m, format) {
14246
- var weekdays = isArray(this._weekdays) ? this._weekdays :
14247
- this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
14248
- return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
14249
- : (m) ? weekdays[m.day()] : weekdays;
14229
+ if (!m) {
14230
+ return isArray(this._weekdays) ? this._weekdays :
14231
+ this._weekdays['standalone'];
14232
+ }
14233
+ return isArray(this._weekdays) ? this._weekdays[m.day()] :
14234
+ this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
14250
14235
  }
14251
14236
 
14252
14237
  var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
14253
14238
  function localeWeekdaysShort (m) {
14254
- return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
14255
- : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
14239
+ return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
14256
14240
  }
14257
14241
 
14258
14242
  var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
14259
14243
  function localeWeekdaysMin (m) {
14260
- return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
14261
- : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
14244
+ return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
14262
14245
  }
14263
14246
 
14264
14247
  function handleStrictParse$1(weekdayName, format, strict) {
@@ -15007,13 +14990,13 @@ moment.tz.load(require('./data/packed/latest.json'));
15007
14990
  weekdayOverflow = true;
15008
14991
  }
15009
14992
  } else if (w.e != null) {
15010
- // local weekday -- counting starts from beginning of week
14993
+ // local weekday -- counting starts from begining of week
15011
14994
  weekday = w.e + dow;
15012
14995
  if (w.e < 0 || w.e > 6) {
15013
14996
  weekdayOverflow = true;
15014
14997
  }
15015
14998
  } else {
15016
- // default to beginning of week
14999
+ // default to begining of week
15017
15000
  weekday = dow;
15018
15001
  }
15019
15002
  }
@@ -15607,7 +15590,7 @@ moment.tz.load(require('./data/packed/latest.json'));
15607
15590
  years = normalizedInput.year || 0,
15608
15591
  quarters = normalizedInput.quarter || 0,
15609
15592
  months = normalizedInput.month || 0,
15610
- weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
15593
+ weeks = normalizedInput.week || 0,
15611
15594
  days = normalizedInput.day || 0,
15612
15595
  hours = normalizedInput.hour || 0,
15613
15596
  minutes = normalizedInput.minute || 0,
@@ -15911,7 +15894,7 @@ moment.tz.load(require('./data/packed/latest.json'));
15911
15894
  ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
15912
15895
  };
15913
15896
  } else if (!!(match = isoRegex.exec(input))) {
15914
- sign = (match[1] === '-') ? -1 : 1;
15897
+ sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
15915
15898
  duration = {
15916
15899
  y : parseIso(match[2], sign),
15917
15900
  M : parseIso(match[3], sign),
@@ -15953,7 +15936,7 @@ moment.tz.load(require('./data/packed/latest.json'));
15953
15936
  }
15954
15937
 
15955
15938
  function positiveMomentsDifference(base, other) {
15956
- var res = {};
15939
+ var res = {milliseconds: 0, months: 0};
15957
15940
 
15958
15941
  res.months = other.month() - base.month() +
15959
15942
  (other.year() - base.year()) * 12;
@@ -16062,7 +16045,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16062
16045
  if (!(this.isValid() && localInput.isValid())) {
16063
16046
  return false;
16064
16047
  }
16065
- units = normalizeUnits(units) || 'millisecond';
16048
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
16066
16049
  if (units === 'millisecond') {
16067
16050
  return this.valueOf() > localInput.valueOf();
16068
16051
  } else {
@@ -16075,7 +16058,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16075
16058
  if (!(this.isValid() && localInput.isValid())) {
16076
16059
  return false;
16077
16060
  }
16078
- units = normalizeUnits(units) || 'millisecond';
16061
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
16079
16062
  if (units === 'millisecond') {
16080
16063
  return this.valueOf() < localInput.valueOf();
16081
16064
  } else {
@@ -16084,14 +16067,9 @@ moment.tz.load(require('./data/packed/latest.json'));
16084
16067
  }
16085
16068
 
16086
16069
  function isBetween (from, to, units, inclusivity) {
16087
- var localFrom = isMoment(from) ? from : createLocal(from),
16088
- localTo = isMoment(to) ? to : createLocal(to);
16089
- if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
16090
- return false;
16091
- }
16092
16070
  inclusivity = inclusivity || '()';
16093
- return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
16094
- (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
16071
+ return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
16072
+ (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
16095
16073
  }
16096
16074
 
16097
16075
  function isSame (input, units) {
@@ -16100,7 +16078,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16100
16078
  if (!(this.isValid() && localInput.isValid())) {
16101
16079
  return false;
16102
16080
  }
16103
- units = normalizeUnits(units) || 'millisecond';
16081
+ units = normalizeUnits(units || 'millisecond');
16104
16082
  if (units === 'millisecond') {
16105
16083
  return this.valueOf() === localInput.valueOf();
16106
16084
  } else {
@@ -16110,11 +16088,11 @@ moment.tz.load(require('./data/packed/latest.json'));
16110
16088
  }
16111
16089
 
16112
16090
  function isSameOrAfter (input, units) {
16113
- return this.isSame(input, units) || this.isAfter(input, units);
16091
+ return this.isSame(input, units) || this.isAfter(input,units);
16114
16092
  }
16115
16093
 
16116
16094
  function isSameOrBefore (input, units) {
16117
- return this.isSame(input, units) || this.isBefore(input, units);
16095
+ return this.isSame(input, units) || this.isBefore(input,units);
16118
16096
  }
16119
16097
 
16120
16098
  function diff (input, units, asFloat) {
@@ -16291,130 +16269,62 @@ moment.tz.load(require('./data/packed/latest.json'));
16291
16269
  return this._locale;
16292
16270
  }
16293
16271
 
16294
- var MS_PER_SECOND = 1000;
16295
- var MS_PER_MINUTE = 60 * MS_PER_SECOND;
16296
- var MS_PER_HOUR = 60 * MS_PER_MINUTE;
16297
- var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
16298
-
16299
- // actual modulo - handles negative numbers (for dates before 1970):
16300
- function mod$1(dividend, divisor) {
16301
- return (dividend % divisor + divisor) % divisor;
16302
- }
16303
-
16304
- function localStartOfDate(y, m, d) {
16305
- // the date constructor remaps years 0-99 to 1900-1999
16306
- if (y < 100 && y >= 0) {
16307
- // preserve leap years using a full 400 year cycle, then reset
16308
- return new Date(y + 400, m, d) - MS_PER_400_YEARS;
16309
- } else {
16310
- return new Date(y, m, d).valueOf();
16311
- }
16312
- }
16313
-
16314
- function utcStartOfDate(y, m, d) {
16315
- // Date.UTC remaps years 0-99 to 1900-1999
16316
- if (y < 100 && y >= 0) {
16317
- // preserve leap years using a full 400 year cycle, then reset
16318
- return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
16319
- } else {
16320
- return Date.UTC(y, m, d);
16321
- }
16322
- }
16323
-
16324
16272
  function startOf (units) {
16325
- var time;
16326
16273
  units = normalizeUnits(units);
16327
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
16328
- return this;
16329
- }
16330
-
16331
- var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
16332
-
16274
+ // the following switch intentionally omits break keywords
16275
+ // to utilize falling through the cases.
16333
16276
  switch (units) {
16334
16277
  case 'year':
16335
- time = startOfDate(this.year(), 0, 1);
16336
- break;
16278
+ this.month(0);
16279
+ /* falls through */
16337
16280
  case 'quarter':
16338
- time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
16339
- break;
16340
16281
  case 'month':
16341
- time = startOfDate(this.year(), this.month(), 1);
16342
- break;
16282
+ this.date(1);
16283
+ /* falls through */
16343
16284
  case 'week':
16344
- time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
16345
- break;
16346
16285
  case 'isoWeek':
16347
- time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
16348
- break;
16349
16286
  case 'day':
16350
16287
  case 'date':
16351
- time = startOfDate(this.year(), this.month(), this.date());
16352
- break;
16288
+ this.hours(0);
16289
+ /* falls through */
16353
16290
  case 'hour':
16354
- time = this._d.valueOf();
16355
- time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
16356
- break;
16291
+ this.minutes(0);
16292
+ /* falls through */
16357
16293
  case 'minute':
16358
- time = this._d.valueOf();
16359
- time -= mod$1(time, MS_PER_MINUTE);
16360
- break;
16294
+ this.seconds(0);
16295
+ /* falls through */
16361
16296
  case 'second':
16362
- time = this._d.valueOf();
16363
- time -= mod$1(time, MS_PER_SECOND);
16364
- break;
16297
+ this.milliseconds(0);
16298
+ }
16299
+
16300
+ // weeks are a special case
16301
+ if (units === 'week') {
16302
+ this.weekday(0);
16303
+ }
16304
+ if (units === 'isoWeek') {
16305
+ this.isoWeekday(1);
16306
+ }
16307
+
16308
+ // quarters are also special
16309
+ if (units === 'quarter') {
16310
+ this.month(Math.floor(this.month() / 3) * 3);
16365
16311
  }
16366
16312
 
16367
- this._d.setTime(time);
16368
- hooks.updateOffset(this, true);
16369
16313
  return this;
16370
16314
  }
16371
16315
 
16372
16316
  function endOf (units) {
16373
- var time;
16374
16317
  units = normalizeUnits(units);
16375
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
16318
+ if (units === undefined || units === 'millisecond') {
16376
16319
  return this;
16377
16320
  }
16378
16321
 
16379
- var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
16380
-
16381
- switch (units) {
16382
- case 'year':
16383
- time = startOfDate(this.year() + 1, 0, 1) - 1;
16384
- break;
16385
- case 'quarter':
16386
- time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
16387
- break;
16388
- case 'month':
16389
- time = startOfDate(this.year(), this.month() + 1, 1) - 1;
16390
- break;
16391
- case 'week':
16392
- time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
16393
- break;
16394
- case 'isoWeek':
16395
- time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
16396
- break;
16397
- case 'day':
16398
- case 'date':
16399
- time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
16400
- break;
16401
- case 'hour':
16402
- time = this._d.valueOf();
16403
- time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
16404
- break;
16405
- case 'minute':
16406
- time = this._d.valueOf();
16407
- time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
16408
- break;
16409
- case 'second':
16410
- time = this._d.valueOf();
16411
- time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
16412
- break;
16322
+ // 'date' is an alias for 'day', so it should be considered as such.
16323
+ if (units === 'date') {
16324
+ units = 'day';
16413
16325
  }
16414
16326
 
16415
- this._d.setTime(time);
16416
- hooks.updateOffset(this, true);
16417
- return this;
16327
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
16418
16328
  }
16419
16329
 
16420
16330
  function valueOf () {
@@ -17120,14 +17030,10 @@ moment.tz.load(require('./data/packed/latest.json'));
17120
17030
 
17121
17031
  units = normalizeUnits(units);
17122
17032
 
17123
- if (units === 'month' || units === 'quarter' || units === 'year') {
17124
- days = this._days + milliseconds / 864e5;
17033
+ if (units === 'month' || units === 'year') {
17034
+ days = this._days + milliseconds / 864e5;
17125
17035
  months = this._months + daysToMonths(days);
17126
- switch (units) {
17127
- case 'month': return months;
17128
- case 'quarter': return months / 3;
17129
- case 'year': return months / 12;
17130
- }
17036
+ return units === 'month' ? months : months / 12;
17131
17037
  } else {
17132
17038
  // handle milliseconds separately because of floating point math errors (issue #1867)
17133
17039
  days = this._days + Math.round(monthsToDays(this._months));
@@ -17170,7 +17076,6 @@ moment.tz.load(require('./data/packed/latest.json'));
17170
17076
  var asDays = makeAs('d');
17171
17077
  var asWeeks = makeAs('w');
17172
17078
  var asMonths = makeAs('M');
17173
- var asQuarters = makeAs('Q');
17174
17079
  var asYears = makeAs('y');
17175
17080
 
17176
17081
  function clone$1 () {
@@ -17362,7 +17267,6 @@ moment.tz.load(require('./data/packed/latest.json'));
17362
17267
  proto$2.asDays = asDays;
17363
17268
  proto$2.asWeeks = asWeeks;
17364
17269
  proto$2.asMonths = asMonths;
17365
- proto$2.asQuarters = asQuarters;
17366
17270
  proto$2.asYears = asYears;
17367
17271
  proto$2.valueOf = valueOf$1;
17368
17272
  proto$2._bubble = bubble;
@@ -17407,7 +17311,7 @@ moment.tz.load(require('./data/packed/latest.json'));
17407
17311
  // Side effect imports
17408
17312
 
17409
17313
 
17410
- hooks.version = '2.24.0';
17314
+ hooks.version = '2.22.2';
17411
17315
 
17412
17316
  setHookCallback(createLocal);
17413
17317
 
@@ -17448,7 +17352,7 @@ moment.tz.load(require('./data/packed/latest.json'));
17448
17352
  TIME: 'HH:mm', // <input type="time" />
17449
17353
  TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
17450
17354
  TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
17451
- WEEK: 'GGGG-[W]WW', // <input type="week" />
17355
+ WEEK: 'YYYY-[W]WW', // <input type="week" />
17452
17356
  MONTH: 'YYYY-MM' // <input type="month" />
17453
17357
  };
17454
17358