@zeniai/client-epic-state 4.13.46 → 4.13.48

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.
@@ -58,10 +58,19 @@ const defaultMonthYearPeriod = {
58
58
  };
59
59
  const getDefaultSelectedPeriodsForTenants = (tenantsData) => {
60
60
  const defaultSelectedPeriodsForTenants = tenantsData.tenants.reduce((prev, currentTenant) => {
61
- const monthYearPeriod = currentTenant.zeni_book_close_month_and_year != null
61
+ const currentMonthYearPeriod = currentTenant.zeni_book_close_month_and_year != null
62
62
  ? (0, timePeriod_1.toMonthYearPeriod)(currentTenant.zeni_book_close_month_and_year)
63
- : defaultMonthYearPeriod;
64
- return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: monthYearPeriod });
63
+ : undefined;
64
+ if (currentMonthYearPeriod != null) {
65
+ const currentDate = (0, zeniDayJS_1.date)(`${currentMonthYearPeriod.year}-${currentMonthYearPeriod.month}-01`);
66
+ const nextMonthDate = currentDate.add(1, 'month');
67
+ const nextMonthPeriod = {
68
+ month: (0, timePeriod_1.toMonth)(nextMonthDate.month() + 1),
69
+ year: nextMonthDate.year(),
70
+ };
71
+ return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: nextMonthPeriod });
72
+ }
73
+ return Object.assign(Object.assign({}, prev), { [currentTenant.tenant_id]: defaultMonthYearPeriod });
65
74
  }, {});
66
75
  return defaultSelectedPeriodsForTenants;
67
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.46",
3
+ "version": "4.13.48",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",