@barchart/portfolio-api-common 1.2.105 → 1.2.109
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.
|
@@ -104,7 +104,7 @@ module.exports = (() => {
|
|
|
104
104
|
}, { });
|
|
105
105
|
|
|
106
106
|
this._items = positions.reduce((items, position) => {
|
|
107
|
-
const item = createPositionItem.call(this, position);
|
|
107
|
+
const item = createPositionItem.call(this, position, reportFrame ? true : false);
|
|
108
108
|
|
|
109
109
|
if (item) {
|
|
110
110
|
items.push(item);
|
|
@@ -313,7 +313,7 @@ module.exports = (() => {
|
|
|
313
313
|
addSummaryPrevious(this._summariesPrevious, summary, this._previousSummaryFrame, this._previousSummaryRanges);
|
|
314
314
|
});
|
|
315
315
|
|
|
316
|
-
const item = createPositionItem.call(this, position);
|
|
316
|
+
const item = createPositionItem.call(this, position, false);
|
|
317
317
|
|
|
318
318
|
addBarchartSymbol(this._symbols, item);
|
|
319
319
|
addDisplaySymbol(this._symbolsDisplay, item);
|
|
@@ -959,7 +959,7 @@ module.exports = (() => {
|
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
|
|
962
|
-
function createPositionItem(position,
|
|
962
|
+
function createPositionItem(position, requireCurrentSummary) {
|
|
963
963
|
const portfolio = this._portfolios[position.portfolio];
|
|
964
964
|
|
|
965
965
|
let returnRef;
|
|
@@ -968,7 +968,11 @@ module.exports = (() => {
|
|
|
968
968
|
const currentSummary = this._summariesCurrent[ position.position ] || null;
|
|
969
969
|
const previousSummaries = this._summariesPrevious[ position.position ] || getSummaryArray(this._previousSummaryRanges);
|
|
970
970
|
|
|
971
|
-
|
|
971
|
+
if (!requireCurrentSummary || currentSummary !== null) {
|
|
972
|
+
returnRef = new PositionItem(portfolio, position, currentSummary, previousSummaries, this._reporting);
|
|
973
|
+
} else {
|
|
974
|
+
returnRef = null;
|
|
975
|
+
}
|
|
972
976
|
} else {
|
|
973
977
|
returnRef = null;
|
|
974
978
|
}
|
|
@@ -166,10 +166,14 @@ module.exports = (() => {
|
|
|
166
166
|
this._dataFormat.cashTotal = null;
|
|
167
167
|
this._dataFormat.portfolioType = null;
|
|
168
168
|
|
|
169
|
+
this._dataActual.periodPrice = null;
|
|
170
|
+
this._dataActual.periodPricePrevious = null;
|
|
169
171
|
this._dataActual.periodRealized = null;
|
|
170
172
|
this._dataActual.periodUnrealized = null;
|
|
171
173
|
this._dataActual.periodIncome = null;
|
|
172
174
|
|
|
175
|
+
this._dataFormat.periodPrice = null;
|
|
176
|
+
this._dataFormat.periodPricePrevious = null;
|
|
173
177
|
this._dataFormat.periodRealized = null;
|
|
174
178
|
this._dataFormat.periodUnrealized = null;
|
|
175
179
|
this._dataFormat.periodIncome = null;
|
|
@@ -730,16 +734,22 @@ module.exports = (() => {
|
|
|
730
734
|
if (group.single && group._items.length === 1) {
|
|
731
735
|
const item = group._items[0];
|
|
732
736
|
|
|
733
|
-
actual.quantity = item.
|
|
737
|
+
actual.quantity = item.data.quantity;
|
|
734
738
|
actual.quantityPrevious = item.data.quantityPrevious;
|
|
735
739
|
|
|
736
740
|
actual.basisPrice = item.data.basisPrice;
|
|
737
741
|
|
|
742
|
+
actual.periodPrice = item.data.periodPrice;
|
|
743
|
+
actual.periodPricePrevious = item.data.periodPricePrevious;
|
|
744
|
+
|
|
738
745
|
format.quantity = formatDecimal(actual.quantity, 2);
|
|
739
746
|
format.quantityPrevious = formatDecimal(actual.quantityPrevious, 2);
|
|
740
|
-
|
|
747
|
+
|
|
741
748
|
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
742
749
|
|
|
750
|
+
format.periodPrice = formatCurrency(actual.periodPrice, currency);
|
|
751
|
+
format.periodPricePrevious = formatCurrency(actual.periodPricePrevious, currency);
|
|
752
|
+
|
|
743
753
|
format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
|
|
744
754
|
format.locked = definition.type === PositionLevelType.POSITION && item.data.locked;
|
|
745
755
|
}
|
|
@@ -71,15 +71,19 @@ module.exports = (() => {
|
|
|
71
71
|
this._data.marketPrevious = null;
|
|
72
72
|
this._data.marketPrevious2 = null;
|
|
73
73
|
|
|
74
|
+
this._data.quantity = null;
|
|
74
75
|
this._data.quantityPrevious = null;
|
|
75
|
-
this._data.quantityPrevious2 = null;
|
|
76
76
|
|
|
77
77
|
this._data.realized = null;
|
|
78
78
|
this._data.income = null;
|
|
79
79
|
this._data.basisPrice = null;
|
|
80
80
|
|
|
81
|
-
this._data.
|
|
82
|
-
this._data.
|
|
81
|
+
this._data.periodRealized = null;
|
|
82
|
+
this._data.periodUnrealized = null;
|
|
83
|
+
this._data.periodIncome = null;
|
|
84
|
+
|
|
85
|
+
this._data.periodPrice = null;
|
|
86
|
+
this._data.periodPricePrevious = null;
|
|
83
87
|
|
|
84
88
|
this._data.newsExists = false;
|
|
85
89
|
this._data.fundamental = { };
|
|
@@ -370,16 +374,18 @@ module.exports = (() => {
|
|
|
370
374
|
|
|
371
375
|
function calculateStaticData(item) {
|
|
372
376
|
const position = item.position;
|
|
373
|
-
const snapshot = getSnapshot(position, item.currentSummary, item._reporting);
|
|
374
377
|
|
|
375
|
-
const
|
|
378
|
+
const currentSummary = item.currentSummary;
|
|
379
|
+
|
|
380
|
+
const previousSummary1 = getPreviousSummary(item.previousSummaries, 1);
|
|
381
|
+
const previousSummary2 = getPreviousSummary(item.previousSummaries, 2);
|
|
382
|
+
const previousSummary3 = getPreviousSummary(item.previousSummaries, 3);
|
|
376
383
|
|
|
377
|
-
const
|
|
378
|
-
const previousSummary2 = getPreviousSummary(previousSummaries, 2);
|
|
379
|
-
const previousSummary3 = getPreviousSummary(previousSummaries, 3);
|
|
384
|
+
const snapshot = getSnapshot(position, currentSummary, item._reporting);
|
|
380
385
|
|
|
381
386
|
const data = item._data;
|
|
382
387
|
|
|
388
|
+
data.quantity = snapshot.open;
|
|
383
389
|
data.previousPrice = position.previous || null;
|
|
384
390
|
|
|
385
391
|
let basis;
|
|
@@ -414,6 +420,18 @@ module.exports = (() => {
|
|
|
414
420
|
} else {
|
|
415
421
|
data.basisPrice = basis.divide(snapshot.open);
|
|
416
422
|
}
|
|
423
|
+
|
|
424
|
+
if (currentSummary && !currentSummary.end.open.getIsZero()) {
|
|
425
|
+
data.periodPrice = currentSummary.end.value.divide(currentSummary.end.open);
|
|
426
|
+
} else {
|
|
427
|
+
data.periodPrice = null;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (previousSummary1 && !previousSummary1.end.open.getIsZero()) {
|
|
431
|
+
data.periodPricePrevious = previousSummary1.end.value.divide(previousSummary1.end.open);
|
|
432
|
+
} else {
|
|
433
|
+
data.periodPricePrevious = null;
|
|
434
|
+
}
|
|
417
435
|
}
|
|
418
436
|
|
|
419
437
|
function calculatePriceData(item, price) {
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1528,7 +1528,7 @@ module.exports = (() => {
|
|
|
1528
1528
|
}, { });
|
|
1529
1529
|
|
|
1530
1530
|
this._items = positions.reduce((items, position) => {
|
|
1531
|
-
const item = createPositionItem.call(this, position);
|
|
1531
|
+
const item = createPositionItem.call(this, position, reportFrame ? true : false);
|
|
1532
1532
|
|
|
1533
1533
|
if (item) {
|
|
1534
1534
|
items.push(item);
|
|
@@ -1737,7 +1737,7 @@ module.exports = (() => {
|
|
|
1737
1737
|
addSummaryPrevious(this._summariesPrevious, summary, this._previousSummaryFrame, this._previousSummaryRanges);
|
|
1738
1738
|
});
|
|
1739
1739
|
|
|
1740
|
-
const item = createPositionItem.call(this, position);
|
|
1740
|
+
const item = createPositionItem.call(this, position, false);
|
|
1741
1741
|
|
|
1742
1742
|
addBarchartSymbol(this._symbols, item);
|
|
1743
1743
|
addDisplaySymbol(this._symbolsDisplay, item);
|
|
@@ -2383,7 +2383,7 @@ module.exports = (() => {
|
|
|
2383
2383
|
}
|
|
2384
2384
|
}
|
|
2385
2385
|
|
|
2386
|
-
function createPositionItem(position,
|
|
2386
|
+
function createPositionItem(position, requireCurrentSummary) {
|
|
2387
2387
|
const portfolio = this._portfolios[position.portfolio];
|
|
2388
2388
|
|
|
2389
2389
|
let returnRef;
|
|
@@ -2392,7 +2392,11 @@ module.exports = (() => {
|
|
|
2392
2392
|
const currentSummary = this._summariesCurrent[ position.position ] || null;
|
|
2393
2393
|
const previousSummaries = this._summariesPrevious[ position.position ] || getSummaryArray(this._previousSummaryRanges);
|
|
2394
2394
|
|
|
2395
|
-
|
|
2395
|
+
if (!requireCurrentSummary || currentSummary !== null) {
|
|
2396
|
+
returnRef = new PositionItem(portfolio, position, currentSummary, previousSummaries, this._reporting);
|
|
2397
|
+
} else {
|
|
2398
|
+
returnRef = null;
|
|
2399
|
+
}
|
|
2396
2400
|
} else {
|
|
2397
2401
|
returnRef = null;
|
|
2398
2402
|
}
|
|
@@ -2622,10 +2626,14 @@ module.exports = (() => {
|
|
|
2622
2626
|
this._dataFormat.cashTotal = null;
|
|
2623
2627
|
this._dataFormat.portfolioType = null;
|
|
2624
2628
|
|
|
2629
|
+
this._dataActual.periodPrice = null;
|
|
2630
|
+
this._dataActual.periodPricePrevious = null;
|
|
2625
2631
|
this._dataActual.periodRealized = null;
|
|
2626
2632
|
this._dataActual.periodUnrealized = null;
|
|
2627
2633
|
this._dataActual.periodIncome = null;
|
|
2628
2634
|
|
|
2635
|
+
this._dataFormat.periodPrice = null;
|
|
2636
|
+
this._dataFormat.periodPricePrevious = null;
|
|
2629
2637
|
this._dataFormat.periodRealized = null;
|
|
2630
2638
|
this._dataFormat.periodUnrealized = null;
|
|
2631
2639
|
this._dataFormat.periodIncome = null;
|
|
@@ -3186,16 +3194,22 @@ module.exports = (() => {
|
|
|
3186
3194
|
if (group.single && group._items.length === 1) {
|
|
3187
3195
|
const item = group._items[0];
|
|
3188
3196
|
|
|
3189
|
-
actual.quantity = item.
|
|
3197
|
+
actual.quantity = item.data.quantity;
|
|
3190
3198
|
actual.quantityPrevious = item.data.quantityPrevious;
|
|
3191
3199
|
|
|
3192
3200
|
actual.basisPrice = item.data.basisPrice;
|
|
3193
3201
|
|
|
3202
|
+
actual.periodPrice = item.data.periodPrice;
|
|
3203
|
+
actual.periodPricePrevious = item.data.periodPricePrevious;
|
|
3204
|
+
|
|
3194
3205
|
format.quantity = formatDecimal(actual.quantity, 2);
|
|
3195
3206
|
format.quantityPrevious = formatDecimal(actual.quantityPrevious, 2);
|
|
3196
|
-
|
|
3207
|
+
|
|
3197
3208
|
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
3198
3209
|
|
|
3210
|
+
format.periodPrice = formatCurrency(actual.periodPrice, currency);
|
|
3211
|
+
format.periodPricePrevious = formatCurrency(actual.periodPricePrevious, currency);
|
|
3212
|
+
|
|
3199
3213
|
format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
|
|
3200
3214
|
format.locked = definition.type === PositionLevelType.POSITION && item.data.locked;
|
|
3201
3215
|
}
|
|
@@ -3458,15 +3472,19 @@ module.exports = (() => {
|
|
|
3458
3472
|
this._data.marketPrevious = null;
|
|
3459
3473
|
this._data.marketPrevious2 = null;
|
|
3460
3474
|
|
|
3475
|
+
this._data.quantity = null;
|
|
3461
3476
|
this._data.quantityPrevious = null;
|
|
3462
|
-
this._data.quantityPrevious2 = null;
|
|
3463
3477
|
|
|
3464
3478
|
this._data.realized = null;
|
|
3465
3479
|
this._data.income = null;
|
|
3466
3480
|
this._data.basisPrice = null;
|
|
3467
3481
|
|
|
3468
|
-
this._data.
|
|
3469
|
-
this._data.
|
|
3482
|
+
this._data.periodRealized = null;
|
|
3483
|
+
this._data.periodUnrealized = null;
|
|
3484
|
+
this._data.periodIncome = null;
|
|
3485
|
+
|
|
3486
|
+
this._data.periodPrice = null;
|
|
3487
|
+
this._data.periodPricePrevious = null;
|
|
3470
3488
|
|
|
3471
3489
|
this._data.newsExists = false;
|
|
3472
3490
|
this._data.fundamental = { };
|
|
@@ -3757,16 +3775,18 @@ module.exports = (() => {
|
|
|
3757
3775
|
|
|
3758
3776
|
function calculateStaticData(item) {
|
|
3759
3777
|
const position = item.position;
|
|
3760
|
-
const snapshot = getSnapshot(position, item.currentSummary, item._reporting);
|
|
3761
3778
|
|
|
3762
|
-
const
|
|
3779
|
+
const currentSummary = item.currentSummary;
|
|
3780
|
+
|
|
3781
|
+
const previousSummary1 = getPreviousSummary(item.previousSummaries, 1);
|
|
3782
|
+
const previousSummary2 = getPreviousSummary(item.previousSummaries, 2);
|
|
3783
|
+
const previousSummary3 = getPreviousSummary(item.previousSummaries, 3);
|
|
3763
3784
|
|
|
3764
|
-
const
|
|
3765
|
-
const previousSummary2 = getPreviousSummary(previousSummaries, 2);
|
|
3766
|
-
const previousSummary3 = getPreviousSummary(previousSummaries, 3);
|
|
3785
|
+
const snapshot = getSnapshot(position, currentSummary, item._reporting);
|
|
3767
3786
|
|
|
3768
3787
|
const data = item._data;
|
|
3769
3788
|
|
|
3789
|
+
data.quantity = snapshot.open;
|
|
3770
3790
|
data.previousPrice = position.previous || null;
|
|
3771
3791
|
|
|
3772
3792
|
let basis;
|
|
@@ -3801,6 +3821,18 @@ module.exports = (() => {
|
|
|
3801
3821
|
} else {
|
|
3802
3822
|
data.basisPrice = basis.divide(snapshot.open);
|
|
3803
3823
|
}
|
|
3824
|
+
|
|
3825
|
+
if (currentSummary && !currentSummary.end.open.getIsZero()) {
|
|
3826
|
+
data.periodPrice = currentSummary.end.value.divide(currentSummary.end.open);
|
|
3827
|
+
} else {
|
|
3828
|
+
data.periodPrice = null;
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3831
|
+
if (previousSummary1 && !previousSummary1.end.open.getIsZero()) {
|
|
3832
|
+
data.periodPricePrevious = previousSummary1.end.value.divide(previousSummary1.end.open);
|
|
3833
|
+
} else {
|
|
3834
|
+
data.periodPricePrevious = null;
|
|
3835
|
+
}
|
|
3804
3836
|
}
|
|
3805
3837
|
|
|
3806
3838
|
function calculatePriceData(item, price) {
|
|
@@ -6268,12 +6300,11 @@ module.exports = function () {
|
|
|
6268
6300
|
}
|
|
6269
6301
|
|
|
6270
6302
|
/**
|
|
6271
|
-
*
|
|
6272
|
-
* a {@link Day} instance.
|
|
6303
|
+
* Clones a {@link Day} instance.
|
|
6273
6304
|
*
|
|
6274
6305
|
* @public
|
|
6275
6306
|
* @static
|
|
6276
|
-
* @param {
|
|
6307
|
+
* @param {Day} value
|
|
6277
6308
|
* @returns {Day}
|
|
6278
6309
|
*/
|
|
6279
6310
|
|
|
@@ -6314,6 +6345,24 @@ module.exports = function () {
|
|
|
6314
6345
|
return this._day;
|
|
6315
6346
|
}
|
|
6316
6347
|
}], [{
|
|
6348
|
+
key: 'clone',
|
|
6349
|
+
value: function clone(value) {
|
|
6350
|
+
assert.argumentIsRequired(value, 'value', Day, 'Day');
|
|
6351
|
+
|
|
6352
|
+
return new Day(value.year, value.month, value.day);
|
|
6353
|
+
}
|
|
6354
|
+
|
|
6355
|
+
/**
|
|
6356
|
+
* Converts a string (which matches the output of {@link Day#format} into
|
|
6357
|
+
* a {@link Day} instance.
|
|
6358
|
+
*
|
|
6359
|
+
* @public
|
|
6360
|
+
* @static
|
|
6361
|
+
* @param {String} value
|
|
6362
|
+
* @returns {Day}
|
|
6363
|
+
*/
|
|
6364
|
+
|
|
6365
|
+
}, {
|
|
6317
6366
|
key: 'parse',
|
|
6318
6367
|
value: function parse(value) {
|
|
6319
6368
|
assert.argumentIsRequired(value, 'value', String);
|
|
@@ -6630,15 +6679,17 @@ module.exports = function () {
|
|
|
6630
6679
|
*
|
|
6631
6680
|
* @public
|
|
6632
6681
|
* @param {Boolean=} approximate
|
|
6682
|
+
* @param {Number=} places
|
|
6633
6683
|
* @returns {Boolean}
|
|
6634
6684
|
*/
|
|
6635
6685
|
|
|
6636
6686
|
}, {
|
|
6637
6687
|
key: 'getIsZero',
|
|
6638
|
-
value: function getIsZero(approximate) {
|
|
6688
|
+
value: function getIsZero(approximate, places) {
|
|
6639
6689
|
assert.argumentIsOptional(approximate, 'approximate', Boolean);
|
|
6690
|
+
assert.argumentIsOptional(places, 'places', Number);
|
|
6640
6691
|
|
|
6641
|
-
return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(
|
|
6692
|
+
return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(places || Big.DP, RoundingMode.NORMAL).getIsZero();
|
|
6642
6693
|
}
|
|
6643
6694
|
|
|
6644
6695
|
/**
|
|
@@ -6737,6 +6788,43 @@ module.exports = function () {
|
|
|
6737
6788
|
return this._big.eq(getBig(other));
|
|
6738
6789
|
}
|
|
6739
6790
|
|
|
6791
|
+
/**
|
|
6792
|
+
* Returns true if the current instance is an integer (i.e. has no decimal
|
|
6793
|
+
* component).
|
|
6794
|
+
*
|
|
6795
|
+
* @public
|
|
6796
|
+
* @return {Boolean}
|
|
6797
|
+
*/
|
|
6798
|
+
|
|
6799
|
+
}, {
|
|
6800
|
+
key: 'getIsInteger',
|
|
6801
|
+
value: function getIsInteger() {
|
|
6802
|
+
return this.getIsEqual(this.round(0));
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6805
|
+
/**
|
|
6806
|
+
* Returns the number of decimal places used.
|
|
6807
|
+
*
|
|
6808
|
+
* @public
|
|
6809
|
+
* @returns {Number}
|
|
6810
|
+
*/
|
|
6811
|
+
|
|
6812
|
+
}, {
|
|
6813
|
+
key: 'getDecimalPlaces',
|
|
6814
|
+
value: function getDecimalPlaces() {
|
|
6815
|
+
var matches = this.toFixed().match(/-?\d*\.(\d*)/);
|
|
6816
|
+
|
|
6817
|
+
var returnVal = void 0;
|
|
6818
|
+
|
|
6819
|
+
if (matches === null) {
|
|
6820
|
+
returnVal = 0;
|
|
6821
|
+
} else {
|
|
6822
|
+
returnVal = matches[1].length;
|
|
6823
|
+
}
|
|
6824
|
+
|
|
6825
|
+
return returnVal;
|
|
6826
|
+
}
|
|
6827
|
+
|
|
6740
6828
|
/**
|
|
6741
6829
|
* Emits a floating point value that approximates the value of the current
|
|
6742
6830
|
* instance.
|
|
@@ -6785,10 +6873,11 @@ module.exports = function () {
|
|
|
6785
6873
|
}
|
|
6786
6874
|
|
|
6787
6875
|
/**
|
|
6788
|
-
*
|
|
6876
|
+
* Clones a {@link Decimal} instance.
|
|
6789
6877
|
*
|
|
6790
6878
|
* @public
|
|
6791
|
-
* @
|
|
6879
|
+
* @static
|
|
6880
|
+
* @param {Decimal} value
|
|
6792
6881
|
* @returns {Decimal}
|
|
6793
6882
|
*/
|
|
6794
6883
|
|
|
@@ -6798,6 +6887,22 @@ module.exports = function () {
|
|
|
6798
6887
|
return '[Decimal]';
|
|
6799
6888
|
}
|
|
6800
6889
|
}], [{
|
|
6890
|
+
key: 'clone',
|
|
6891
|
+
value: function clone(value) {
|
|
6892
|
+
assert.argumentIsRequired(value, 'value', Decimal, 'Decimal');
|
|
6893
|
+
|
|
6894
|
+
return new Decimal(value._big);
|
|
6895
|
+
}
|
|
6896
|
+
|
|
6897
|
+
/**
|
|
6898
|
+
* Parses the value emitted by {@link Decimal#toJSON}.
|
|
6899
|
+
*
|
|
6900
|
+
* @public
|
|
6901
|
+
* @param {String} value
|
|
6902
|
+
* @returns {Decimal}
|
|
6903
|
+
*/
|
|
6904
|
+
|
|
6905
|
+
}, {
|
|
6801
6906
|
key: 'parse',
|
|
6802
6907
|
value: function parse(value) {
|
|
6803
6908
|
return new Decimal(value);
|
|
@@ -7819,10 +7924,11 @@ module.exports = function () {
|
|
|
7819
7924
|
}
|
|
7820
7925
|
|
|
7821
7926
|
/**
|
|
7822
|
-
*
|
|
7927
|
+
* Clones a {@link Timestamp} instance.
|
|
7823
7928
|
*
|
|
7824
7929
|
* @public
|
|
7825
|
-
* @
|
|
7930
|
+
* @static
|
|
7931
|
+
* @param {Timestamp} value
|
|
7826
7932
|
* @returns {Timestamp}
|
|
7827
7933
|
*/
|
|
7828
7934
|
|
|
@@ -7858,6 +7964,22 @@ module.exports = function () {
|
|
|
7858
7964
|
return this._moment;
|
|
7859
7965
|
}
|
|
7860
7966
|
}], [{
|
|
7967
|
+
key: 'clone',
|
|
7968
|
+
value: function clone(value) {
|
|
7969
|
+
assert.argumentIsRequired(value, 'value', Timestamp, 'Timestamp');
|
|
7970
|
+
|
|
7971
|
+
return new Timestamp(value._timestamp, value._timezone);
|
|
7972
|
+
}
|
|
7973
|
+
|
|
7974
|
+
/**
|
|
7975
|
+
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
7976
|
+
*
|
|
7977
|
+
* @public
|
|
7978
|
+
* @param {Number} value
|
|
7979
|
+
* @returns {Timestamp}
|
|
7980
|
+
*/
|
|
7981
|
+
|
|
7982
|
+
}, {
|
|
7861
7983
|
key: 'parse',
|
|
7862
7984
|
value: function parse(value) {
|
|
7863
7985
|
return new Timestamp(value);
|