@barchart/portfolio-api-common 1.2.145 → 1.2.146
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.
|
@@ -450,7 +450,7 @@ module.exports = (() => {
|
|
|
450
450
|
data.periodPricePrevious = null;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
data.totalDivisor = calculateTotalDivisor(position.instrument.type, data.initiate, currentSummary);
|
|
453
|
+
data.totalDivisor = calculateTotalDivisor(position.instrument.type, data.initiate, currentSummary, position);
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
function calculatePriceData(item, price) {
|
|
@@ -645,14 +645,18 @@ module.exports = (() => {
|
|
|
645
645
|
return returnRef;
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
-
function calculateTotalDivisor(type, direction, finalSummary) {
|
|
648
|
+
function calculateTotalDivisor(type, direction, finalSummary, position) {
|
|
649
649
|
let returnRef;
|
|
650
650
|
|
|
651
|
+
// 2019-06-05, BRI. We should be reading from the summary -- in case we are
|
|
652
|
+
// running for a previous period. However, the summary does not have buy and
|
|
653
|
+
// sell totals for the entire history. Could be added.
|
|
654
|
+
|
|
651
655
|
if (finalSummary && type !== InstrumentType.CASH) {
|
|
652
656
|
if (direction === PositionDirection.SHORT) {
|
|
653
|
-
returnRef =
|
|
657
|
+
returnRef = position.snapshot.sells;
|
|
654
658
|
} else {
|
|
655
|
-
returnRef =
|
|
659
|
+
returnRef = position.snapshot.buys.opposite();
|
|
656
660
|
}
|
|
657
661
|
} else {
|
|
658
662
|
returnRef = Decimal.ZERO;
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -3990,7 +3990,7 @@ module.exports = (() => {
|
|
|
3990
3990
|
data.periodPricePrevious = null;
|
|
3991
3991
|
}
|
|
3992
3992
|
|
|
3993
|
-
data.totalDivisor = calculateTotalDivisor(position.instrument.type, data.initiate, currentSummary);
|
|
3993
|
+
data.totalDivisor = calculateTotalDivisor(position.instrument.type, data.initiate, currentSummary, position);
|
|
3994
3994
|
}
|
|
3995
3995
|
|
|
3996
3996
|
function calculatePriceData(item, price) {
|
|
@@ -4185,14 +4185,18 @@ module.exports = (() => {
|
|
|
4185
4185
|
return returnRef;
|
|
4186
4186
|
}
|
|
4187
4187
|
|
|
4188
|
-
function calculateTotalDivisor(type, direction, finalSummary) {
|
|
4188
|
+
function calculateTotalDivisor(type, direction, finalSummary, position) {
|
|
4189
4189
|
let returnRef;
|
|
4190
4190
|
|
|
4191
|
+
// 2019-06-05, BRI. We should be reading from the summary -- in case we are
|
|
4192
|
+
// running for a previous period. However, the summary does not have buy and
|
|
4193
|
+
// sell totals for the entire history. Could be added.
|
|
4194
|
+
|
|
4191
4195
|
if (finalSummary && type !== InstrumentType.CASH) {
|
|
4192
4196
|
if (direction === PositionDirection.SHORT) {
|
|
4193
|
-
returnRef =
|
|
4197
|
+
returnRef = position.snapshot.sells;
|
|
4194
4198
|
} else {
|
|
4195
|
-
returnRef =
|
|
4199
|
+
returnRef = position.snapshot.buys.opposite();
|
|
4196
4200
|
}
|
|
4197
4201
|
} else {
|
|
4198
4202
|
returnRef = Decimal.ZERO;
|
|
@@ -14051,36 +14055,22 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14051
14055
|
function createDate (y, m, d, h, M, s, ms) {
|
|
14052
14056
|
// can't just apply() to create a date:
|
|
14053
14057
|
// https://stackoverflow.com/q/181348
|
|
14054
|
-
var date;
|
|
14058
|
+
var date = new Date(y, m, d, h, M, s, ms);
|
|
14059
|
+
|
|
14055
14060
|
// the date constructor remaps years 0-99 to 1900-1999
|
|
14056
|
-
if (y < 100 && y >= 0) {
|
|
14057
|
-
|
|
14058
|
-
date = new Date(y + 400, m, d, h, M, s, ms);
|
|
14059
|
-
if (isFinite(date.getFullYear())) {
|
|
14060
|
-
date.setFullYear(y);
|
|
14061
|
-
}
|
|
14062
|
-
} else {
|
|
14063
|
-
date = new Date(y, m, d, h, M, s, ms);
|
|
14061
|
+
if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
|
|
14062
|
+
date.setFullYear(y);
|
|
14064
14063
|
}
|
|
14065
|
-
|
|
14066
14064
|
return date;
|
|
14067
14065
|
}
|
|
14068
14066
|
|
|
14069
14067
|
function createUTCDate (y) {
|
|
14070
|
-
var date;
|
|
14068
|
+
var date = new Date(Date.UTC.apply(null, arguments));
|
|
14069
|
+
|
|
14071
14070
|
// the Date.UTC function remaps years 0-99 to 1900-1999
|
|
14072
|
-
if (y < 100 && y >= 0) {
|
|
14073
|
-
|
|
14074
|
-
// preserve leap years using a full 400 year cycle, then reset
|
|
14075
|
-
args[0] = y + 400;
|
|
14076
|
-
date = new Date(Date.UTC.apply(null, args));
|
|
14077
|
-
if (isFinite(date.getUTCFullYear())) {
|
|
14078
|
-
date.setUTCFullYear(y);
|
|
14079
|
-
}
|
|
14080
|
-
} else {
|
|
14081
|
-
date = new Date(Date.UTC.apply(null, arguments));
|
|
14071
|
+
if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
|
|
14072
|
+
date.setUTCFullYear(y);
|
|
14082
14073
|
}
|
|
14083
|
-
|
|
14084
14074
|
return date;
|
|
14085
14075
|
}
|
|
14086
14076
|
|
|
@@ -14182,7 +14172,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14182
14172
|
|
|
14183
14173
|
var defaultLocaleWeek = {
|
|
14184
14174
|
dow : 0, // Sunday is the first day of the week.
|
|
14185
|
-
doy : 6 // The week that contains Jan
|
|
14175
|
+
doy : 6 // The week that contains Jan 1st is the first week of the year.
|
|
14186
14176
|
};
|
|
14187
14177
|
|
|
14188
14178
|
function localeFirstDayOfWeek () {
|
|
@@ -14291,28 +14281,25 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14291
14281
|
}
|
|
14292
14282
|
|
|
14293
14283
|
// LOCALES
|
|
14294
|
-
function shiftWeekdays (ws, n) {
|
|
14295
|
-
return ws.slice(n, 7).concat(ws.slice(0, n));
|
|
14296
|
-
}
|
|
14297
14284
|
|
|
14298
14285
|
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
|
|
14299
14286
|
function localeWeekdays (m, format) {
|
|
14300
|
-
|
|
14301
|
-
this._weekdays
|
|
14302
|
-
|
|
14303
|
-
|
|
14287
|
+
if (!m) {
|
|
14288
|
+
return isArray(this._weekdays) ? this._weekdays :
|
|
14289
|
+
this._weekdays['standalone'];
|
|
14290
|
+
}
|
|
14291
|
+
return isArray(this._weekdays) ? this._weekdays[m.day()] :
|
|
14292
|
+
this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
|
|
14304
14293
|
}
|
|
14305
14294
|
|
|
14306
14295
|
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
|
|
14307
14296
|
function localeWeekdaysShort (m) {
|
|
14308
|
-
return (m
|
|
14309
|
-
: (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
|
|
14297
|
+
return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
|
|
14310
14298
|
}
|
|
14311
14299
|
|
|
14312
14300
|
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
|
|
14313
14301
|
function localeWeekdaysMin (m) {
|
|
14314
|
-
return (m
|
|
14315
|
-
: (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
|
|
14302
|
+
return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
|
|
14316
14303
|
}
|
|
14317
14304
|
|
|
14318
14305
|
function handleStrictParse$1(weekdayName, format, strict) {
|
|
@@ -15061,13 +15048,13 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
15061
15048
|
weekdayOverflow = true;
|
|
15062
15049
|
}
|
|
15063
15050
|
} else if (w.e != null) {
|
|
15064
|
-
// local weekday -- counting starts from
|
|
15051
|
+
// local weekday -- counting starts from begining of week
|
|
15065
15052
|
weekday = w.e + dow;
|
|
15066
15053
|
if (w.e < 0 || w.e > 6) {
|
|
15067
15054
|
weekdayOverflow = true;
|
|
15068
15055
|
}
|
|
15069
15056
|
} else {
|
|
15070
|
-
// default to
|
|
15057
|
+
// default to begining of week
|
|
15071
15058
|
weekday = dow;
|
|
15072
15059
|
}
|
|
15073
15060
|
}
|
|
@@ -15661,7 +15648,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
15661
15648
|
years = normalizedInput.year || 0,
|
|
15662
15649
|
quarters = normalizedInput.quarter || 0,
|
|
15663
15650
|
months = normalizedInput.month || 0,
|
|
15664
|
-
weeks = normalizedInput.week ||
|
|
15651
|
+
weeks = normalizedInput.week || 0,
|
|
15665
15652
|
days = normalizedInput.day || 0,
|
|
15666
15653
|
hours = normalizedInput.hour || 0,
|
|
15667
15654
|
minutes = normalizedInput.minute || 0,
|
|
@@ -15965,7 +15952,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
15965
15952
|
ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
|
|
15966
15953
|
};
|
|
15967
15954
|
} else if (!!(match = isoRegex.exec(input))) {
|
|
15968
|
-
sign = (match[1] === '-') ? -1 : 1;
|
|
15955
|
+
sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
|
|
15969
15956
|
duration = {
|
|
15970
15957
|
y : parseIso(match[2], sign),
|
|
15971
15958
|
M : parseIso(match[3], sign),
|
|
@@ -16007,7 +15994,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16007
15994
|
}
|
|
16008
15995
|
|
|
16009
15996
|
function positiveMomentsDifference(base, other) {
|
|
16010
|
-
var res = {};
|
|
15997
|
+
var res = {milliseconds: 0, months: 0};
|
|
16011
15998
|
|
|
16012
15999
|
res.months = other.month() - base.month() +
|
|
16013
16000
|
(other.year() - base.year()) * 12;
|
|
@@ -16116,7 +16103,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16116
16103
|
if (!(this.isValid() && localInput.isValid())) {
|
|
16117
16104
|
return false;
|
|
16118
16105
|
}
|
|
16119
|
-
units = normalizeUnits(units)
|
|
16106
|
+
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
|
|
16120
16107
|
if (units === 'millisecond') {
|
|
16121
16108
|
return this.valueOf() > localInput.valueOf();
|
|
16122
16109
|
} else {
|
|
@@ -16129,7 +16116,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16129
16116
|
if (!(this.isValid() && localInput.isValid())) {
|
|
16130
16117
|
return false;
|
|
16131
16118
|
}
|
|
16132
|
-
units = normalizeUnits(units)
|
|
16119
|
+
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
|
|
16133
16120
|
if (units === 'millisecond') {
|
|
16134
16121
|
return this.valueOf() < localInput.valueOf();
|
|
16135
16122
|
} else {
|
|
@@ -16138,14 +16125,9 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16138
16125
|
}
|
|
16139
16126
|
|
|
16140
16127
|
function isBetween (from, to, units, inclusivity) {
|
|
16141
|
-
var localFrom = isMoment(from) ? from : createLocal(from),
|
|
16142
|
-
localTo = isMoment(to) ? to : createLocal(to);
|
|
16143
|
-
if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
|
|
16144
|
-
return false;
|
|
16145
|
-
}
|
|
16146
16128
|
inclusivity = inclusivity || '()';
|
|
16147
|
-
return (inclusivity[0] === '(' ? this.isAfter(
|
|
16148
|
-
(inclusivity[1] === ')' ? this.isBefore(
|
|
16129
|
+
return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
|
|
16130
|
+
(inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
|
|
16149
16131
|
}
|
|
16150
16132
|
|
|
16151
16133
|
function isSame (input, units) {
|
|
@@ -16154,7 +16136,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16154
16136
|
if (!(this.isValid() && localInput.isValid())) {
|
|
16155
16137
|
return false;
|
|
16156
16138
|
}
|
|
16157
|
-
units = normalizeUnits(units
|
|
16139
|
+
units = normalizeUnits(units || 'millisecond');
|
|
16158
16140
|
if (units === 'millisecond') {
|
|
16159
16141
|
return this.valueOf() === localInput.valueOf();
|
|
16160
16142
|
} else {
|
|
@@ -16164,11 +16146,11 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16164
16146
|
}
|
|
16165
16147
|
|
|
16166
16148
|
function isSameOrAfter (input, units) {
|
|
16167
|
-
return this.isSame(input, units) || this.isAfter(input,
|
|
16149
|
+
return this.isSame(input, units) || this.isAfter(input,units);
|
|
16168
16150
|
}
|
|
16169
16151
|
|
|
16170
16152
|
function isSameOrBefore (input, units) {
|
|
16171
|
-
return this.isSame(input, units) || this.isBefore(input,
|
|
16153
|
+
return this.isSame(input, units) || this.isBefore(input,units);
|
|
16172
16154
|
}
|
|
16173
16155
|
|
|
16174
16156
|
function diff (input, units, asFloat) {
|
|
@@ -16345,130 +16327,62 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16345
16327
|
return this._locale;
|
|
16346
16328
|
}
|
|
16347
16329
|
|
|
16348
|
-
var MS_PER_SECOND = 1000;
|
|
16349
|
-
var MS_PER_MINUTE = 60 * MS_PER_SECOND;
|
|
16350
|
-
var MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
|
16351
|
-
var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
|
|
16352
|
-
|
|
16353
|
-
// actual modulo - handles negative numbers (for dates before 1970):
|
|
16354
|
-
function mod$1(dividend, divisor) {
|
|
16355
|
-
return (dividend % divisor + divisor) % divisor;
|
|
16356
|
-
}
|
|
16357
|
-
|
|
16358
|
-
function localStartOfDate(y, m, d) {
|
|
16359
|
-
// the date constructor remaps years 0-99 to 1900-1999
|
|
16360
|
-
if (y < 100 && y >= 0) {
|
|
16361
|
-
// preserve leap years using a full 400 year cycle, then reset
|
|
16362
|
-
return new Date(y + 400, m, d) - MS_PER_400_YEARS;
|
|
16363
|
-
} else {
|
|
16364
|
-
return new Date(y, m, d).valueOf();
|
|
16365
|
-
}
|
|
16366
|
-
}
|
|
16367
|
-
|
|
16368
|
-
function utcStartOfDate(y, m, d) {
|
|
16369
|
-
// Date.UTC remaps years 0-99 to 1900-1999
|
|
16370
|
-
if (y < 100 && y >= 0) {
|
|
16371
|
-
// preserve leap years using a full 400 year cycle, then reset
|
|
16372
|
-
return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
|
|
16373
|
-
} else {
|
|
16374
|
-
return Date.UTC(y, m, d);
|
|
16375
|
-
}
|
|
16376
|
-
}
|
|
16377
|
-
|
|
16378
16330
|
function startOf (units) {
|
|
16379
|
-
var time;
|
|
16380
16331
|
units = normalizeUnits(units);
|
|
16381
|
-
|
|
16382
|
-
|
|
16383
|
-
}
|
|
16384
|
-
|
|
16385
|
-
var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
|
|
16386
|
-
|
|
16332
|
+
// the following switch intentionally omits break keywords
|
|
16333
|
+
// to utilize falling through the cases.
|
|
16387
16334
|
switch (units) {
|
|
16388
16335
|
case 'year':
|
|
16389
|
-
|
|
16390
|
-
|
|
16336
|
+
this.month(0);
|
|
16337
|
+
/* falls through */
|
|
16391
16338
|
case 'quarter':
|
|
16392
|
-
time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
|
|
16393
|
-
break;
|
|
16394
16339
|
case 'month':
|
|
16395
|
-
|
|
16396
|
-
|
|
16340
|
+
this.date(1);
|
|
16341
|
+
/* falls through */
|
|
16397
16342
|
case 'week':
|
|
16398
|
-
time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
|
|
16399
|
-
break;
|
|
16400
16343
|
case 'isoWeek':
|
|
16401
|
-
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
|
|
16402
|
-
break;
|
|
16403
16344
|
case 'day':
|
|
16404
16345
|
case 'date':
|
|
16405
|
-
|
|
16406
|
-
|
|
16346
|
+
this.hours(0);
|
|
16347
|
+
/* falls through */
|
|
16407
16348
|
case 'hour':
|
|
16408
|
-
|
|
16409
|
-
|
|
16410
|
-
break;
|
|
16349
|
+
this.minutes(0);
|
|
16350
|
+
/* falls through */
|
|
16411
16351
|
case 'minute':
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
break;
|
|
16352
|
+
this.seconds(0);
|
|
16353
|
+
/* falls through */
|
|
16415
16354
|
case 'second':
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16355
|
+
this.milliseconds(0);
|
|
16356
|
+
}
|
|
16357
|
+
|
|
16358
|
+
// weeks are a special case
|
|
16359
|
+
if (units === 'week') {
|
|
16360
|
+
this.weekday(0);
|
|
16361
|
+
}
|
|
16362
|
+
if (units === 'isoWeek') {
|
|
16363
|
+
this.isoWeekday(1);
|
|
16364
|
+
}
|
|
16365
|
+
|
|
16366
|
+
// quarters are also special
|
|
16367
|
+
if (units === 'quarter') {
|
|
16368
|
+
this.month(Math.floor(this.month() / 3) * 3);
|
|
16419
16369
|
}
|
|
16420
16370
|
|
|
16421
|
-
this._d.setTime(time);
|
|
16422
|
-
hooks.updateOffset(this, true);
|
|
16423
16371
|
return this;
|
|
16424
16372
|
}
|
|
16425
16373
|
|
|
16426
16374
|
function endOf (units) {
|
|
16427
|
-
var time;
|
|
16428
16375
|
units = normalizeUnits(units);
|
|
16429
|
-
if (units === undefined || units === 'millisecond'
|
|
16376
|
+
if (units === undefined || units === 'millisecond') {
|
|
16430
16377
|
return this;
|
|
16431
16378
|
}
|
|
16432
16379
|
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
case 'year':
|
|
16437
|
-
time = startOfDate(this.year() + 1, 0, 1) - 1;
|
|
16438
|
-
break;
|
|
16439
|
-
case 'quarter':
|
|
16440
|
-
time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
|
|
16441
|
-
break;
|
|
16442
|
-
case 'month':
|
|
16443
|
-
time = startOfDate(this.year(), this.month() + 1, 1) - 1;
|
|
16444
|
-
break;
|
|
16445
|
-
case 'week':
|
|
16446
|
-
time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
|
|
16447
|
-
break;
|
|
16448
|
-
case 'isoWeek':
|
|
16449
|
-
time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
|
|
16450
|
-
break;
|
|
16451
|
-
case 'day':
|
|
16452
|
-
case 'date':
|
|
16453
|
-
time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
|
|
16454
|
-
break;
|
|
16455
|
-
case 'hour':
|
|
16456
|
-
time = this._d.valueOf();
|
|
16457
|
-
time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
|
|
16458
|
-
break;
|
|
16459
|
-
case 'minute':
|
|
16460
|
-
time = this._d.valueOf();
|
|
16461
|
-
time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
|
|
16462
|
-
break;
|
|
16463
|
-
case 'second':
|
|
16464
|
-
time = this._d.valueOf();
|
|
16465
|
-
time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
|
|
16466
|
-
break;
|
|
16380
|
+
// 'date' is an alias for 'day', so it should be considered as such.
|
|
16381
|
+
if (units === 'date') {
|
|
16382
|
+
units = 'day';
|
|
16467
16383
|
}
|
|
16468
16384
|
|
|
16469
|
-
this.
|
|
16470
|
-
hooks.updateOffset(this, true);
|
|
16471
|
-
return this;
|
|
16385
|
+
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
|
|
16472
16386
|
}
|
|
16473
16387
|
|
|
16474
16388
|
function valueOf () {
|
|
@@ -17174,14 +17088,10 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17174
17088
|
|
|
17175
17089
|
units = normalizeUnits(units);
|
|
17176
17090
|
|
|
17177
|
-
if (units === 'month' || units === '
|
|
17178
|
-
days
|
|
17091
|
+
if (units === 'month' || units === 'year') {
|
|
17092
|
+
days = this._days + milliseconds / 864e5;
|
|
17179
17093
|
months = this._months + daysToMonths(days);
|
|
17180
|
-
|
|
17181
|
-
case 'month': return months;
|
|
17182
|
-
case 'quarter': return months / 3;
|
|
17183
|
-
case 'year': return months / 12;
|
|
17184
|
-
}
|
|
17094
|
+
return units === 'month' ? months : months / 12;
|
|
17185
17095
|
} else {
|
|
17186
17096
|
// handle milliseconds separately because of floating point math errors (issue #1867)
|
|
17187
17097
|
days = this._days + Math.round(monthsToDays(this._months));
|
|
@@ -17224,7 +17134,6 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17224
17134
|
var asDays = makeAs('d');
|
|
17225
17135
|
var asWeeks = makeAs('w');
|
|
17226
17136
|
var asMonths = makeAs('M');
|
|
17227
|
-
var asQuarters = makeAs('Q');
|
|
17228
17137
|
var asYears = makeAs('y');
|
|
17229
17138
|
|
|
17230
17139
|
function clone$1 () {
|
|
@@ -17416,7 +17325,6 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17416
17325
|
proto$2.asDays = asDays;
|
|
17417
17326
|
proto$2.asWeeks = asWeeks;
|
|
17418
17327
|
proto$2.asMonths = asMonths;
|
|
17419
|
-
proto$2.asQuarters = asQuarters;
|
|
17420
17328
|
proto$2.asYears = asYears;
|
|
17421
17329
|
proto$2.valueOf = valueOf$1;
|
|
17422
17330
|
proto$2._bubble = bubble;
|
|
@@ -17461,7 +17369,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17461
17369
|
// Side effect imports
|
|
17462
17370
|
|
|
17463
17371
|
|
|
17464
|
-
hooks.version = '2.
|
|
17372
|
+
hooks.version = '2.22.2';
|
|
17465
17373
|
|
|
17466
17374
|
setHookCallback(createLocal);
|
|
17467
17375
|
|
|
@@ -17502,7 +17410,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17502
17410
|
TIME: 'HH:mm', // <input type="time" />
|
|
17503
17411
|
TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
|
|
17504
17412
|
TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
|
|
17505
|
-
WEEK: '
|
|
17413
|
+
WEEK: 'YYYY-[W]WW', // <input type="week" />
|
|
17506
17414
|
MONTH: 'YYYY-MM' // <input type="month" />
|
|
17507
17415
|
};
|
|
17508
17416
|
|
|
@@ -18469,7 +18377,9 @@ describe('When a position container data is gathered', () => {
|
|
|
18469
18377
|
value: new Decimal(456),
|
|
18470
18378
|
open: new Decimal(1),
|
|
18471
18379
|
income: new Decimal(0),
|
|
18472
|
-
gain: new Decimal(0)
|
|
18380
|
+
gain: new Decimal(0),
|
|
18381
|
+
buys: new Decimal(50),
|
|
18382
|
+
sells: new Decimal(0)
|
|
18473
18383
|
}
|
|
18474
18384
|
};
|
|
18475
18385
|
}
|
|
@@ -30,7 +30,9 @@ describe('When a position container data is gathered', () => {
|
|
|
30
30
|
value: new Decimal(456),
|
|
31
31
|
open: new Decimal(1),
|
|
32
32
|
income: new Decimal(0),
|
|
33
|
-
gain: new Decimal(0)
|
|
33
|
+
gain: new Decimal(0),
|
|
34
|
+
buys: new Decimal(50),
|
|
35
|
+
sells: new Decimal(0)
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
}
|