@cubedelement.com/realty-investor-timeline 5.4.0 → 5.5.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.5.1](https://github.com/kvernon/realty-investor-timeline/compare/v5.5.0...v5.5.1) (2026-01-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * boundary, date ([#73](https://github.com/kvernon/realty-investor-timeline/issues/73)) ([1ce43db](https://github.com/kvernon/realty-investor-timeline/commit/1ce43db993397760d2e41e207481f7999158282a))
7
+
8
+ # [5.5.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.4.0...v5.5.0) (2025-12-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * expose cache time ([#72](https://github.com/kvernon/realty-investor-timeline/issues/72)) ([5e1c35f](https://github.com/kvernon/realty-investor-timeline/commit/5e1c35f0d838c6bf7f11e5cd0b380bf4ff6a7203))
14
+
1
15
  # [5.4.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.3.0...v5.4.0) (2025-12-19)
2
16
 
3
17
 
@@ -5,7 +5,9 @@ const getNextExpire = (current, cacheExpireDate, advanceInMonths) => {
5
5
  if (!current) {
6
6
  return cacheExpireDate;
7
7
  }
8
- return new Date(Date.UTC(current.getUTCFullYear(), current.getUTCMonth() + advanceInMonths, 1));
8
+ const date = new Date(Date.UTC(current.getUTCFullYear(), current.getUTCMonth(), 1));
9
+ date.setUTCMonth(date.getUTCMonth() + advanceInMonths);
10
+ return date;
9
11
  };
10
12
  class ValueCache {
11
13
  renewalInMonths;
@@ -181,7 +181,7 @@ class LedgerCollection {
181
181
  return [];
182
182
  }
183
183
  const boundary = year ? this.filter((li) => li.dateMatchesYear(year)) : this.filter();
184
- if (!boundary) {
184
+ if (!boundary || boundary.length === 0) {
185
185
  return [];
186
186
  }
187
187
  const collection = [];
@@ -10,6 +10,10 @@ export interface IGenOptions extends IPropertyEntityOptions {
10
10
  * Used to provide an amount of Random properties
11
11
  */
12
12
  maxRentalOpportunities: number;
13
+ /**
14
+ * Used to say how long a property should be cached
15
+ */
16
+ maxMonthsToCache?: number;
13
17
  }
14
18
  export interface ISimulateOptions {
15
19
  /**
@@ -76,14 +76,16 @@ function simulate(options = {
76
76
  lowestEquityCapturePercent: 7,
77
77
  highestEquityCapturePercent: 15,
78
78
  maxRentalOpportunities: 4,
79
+ maxMonthsToCache: 2,
79
80
  },
80
81
  }) {
81
82
  const formattedUtcDate = (0, data_clone_date_1.cloneDateUtc)(options.startDate ?? new Date());
82
83
  if (!options.generatorOptionsPassiveApartment && !options.generatorOptionsSingleFamily) {
83
84
  throw new Error('Invalid Argument: must declare at least 1, either generatorOptionsSingleFamily or generatorOptionsPassiveApartment');
84
85
  }
85
- const propertyGeneratorSingleFamily = Object.assign(new rental_generator_1.RentalGenerator(new value_cache_1.ValueCache((0, data_clone_date_1.cloneDateUtc)(formattedUtcDate), [], 2), factory_single_family_1.generateSingleFamily), options.generatorOptionsSingleFamily);
86
- const propertyGeneratorPassiveApartment = Object.assign(new rental_generator_1.RentalGenerator(new value_cache_1.ValueCache((0, data_clone_date_1.cloneDateUtc)(formattedUtcDate), [], 2), factory_passive_apartment_1.generateRentalPassiveApartment), options.generatorOptionsPassiveApartment);
86
+ const defaultMaxMonthsToCache = 2;
87
+ const propertyGeneratorSingleFamily = Object.assign(new rental_generator_1.RentalGenerator(new value_cache_1.ValueCache((0, data_clone_date_1.cloneDateUtc)(formattedUtcDate), [], options.generatorOptionsSingleFamily?.maxMonthsToCache || defaultMaxMonthsToCache), factory_single_family_1.generateSingleFamily), options.generatorOptionsSingleFamily);
88
+ const propertyGeneratorPassiveApartment = Object.assign(new rental_generator_1.RentalGenerator(new value_cache_1.ValueCache((0, data_clone_date_1.cloneDateUtc)(formattedUtcDate), [], options.generatorOptionsPassiveApartment?.maxMonthsToCache || defaultMaxMonthsToCache), factory_passive_apartment_1.generateRentalPassiveApartment), options.generatorOptionsPassiveApartment);
87
89
  const totalSavings = new ledger_1.LedgerItem();
88
90
  totalSavings.amount = options.amountInSavings;
89
91
  totalSavings.note = 'money saved up before you start';
@@ -7,7 +7,7 @@ exports.cloneDateUtc = void 0;
7
7
  * @param [datePredicate]
8
8
  */
9
9
  function cloneDateUtc(date, datePredicate) {
10
- const result = new Date(Date.parse(date.toUTCString()));
10
+ const result = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
11
11
  result.setUTCDate(1);
12
12
  result.setUTCHours(0);
13
13
  result.setUTCMinutes(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubedelement.com/realty-investor-timeline",
3
- "version": "5.4.0",
3
+ "version": "5.5.1",
4
4
  "description": "A way to determine if and when your expenses would be covered",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",