@zeniai/client-epic-state 4.18.59 → 4.18.60

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.
@@ -14,7 +14,19 @@ const getCashbackDetail = (state) => {
14
14
  ]);
15
15
  const sortKey = cashbackDetailState.uiState.sortKey;
16
16
  const sortOrder = cashbackDetailState.uiState.sortOrder;
17
- const cashbackInOrder = (0, orderBy_1.default)(cashbackDetailState.cashbackByPeriod, (cashbackPeriod) => {
17
+ // Filter out future periods (period format is "YYYY-MM")
18
+ const currentDate = (0, zeniDayJS_1.dateNow)();
19
+ // Format current date as "YYYY-MM" to match period format:
20
+ // - year() returns the year (e.g., 2024)
21
+ // - month() returns 0-11 (0=January, 11=December), so we add 1 to get 1-12
22
+ // - padStart(2, '0') ensures month is always 2 digits (e.g., "01" for January, "12" for December)
23
+ // This allows lexicographic string comparison with period strings (e.g., "2024-12" <= "2025-01")
24
+ const currentYearMonth = `${currentDate.year()}-${String(currentDate.month() + 1).padStart(2, '0')}`;
25
+ const cashbackByPeriodFiltered = cashbackDetailState.cashbackByPeriod.filter((cashbackPeriod) => {
26
+ // Compare period strings directly since "YYYY-MM" format is lexicographically sortable
27
+ return cashbackPeriod.period <= currentYearMonth;
28
+ });
29
+ const cashbackInOrder = (0, orderBy_1.default)(cashbackByPeriodFiltered, (cashbackPeriod) => {
18
30
  switch (sortKey) {
19
31
  case 'month': {
20
32
  const [year, month] = cashbackPeriod.period.split('-');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.18.59",
3
+ "version": "4.18.60",
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",