@chainlesschain/personal-data-hub 0.4.37 → 0.4.38
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.
|
@@ -127,9 +127,12 @@ async function extractBill(email, opts = {}) {
|
|
|
127
127
|
if (billingPeriod && billingPeriod.start instanceof Date) {
|
|
128
128
|
billingMonth = formatMonthKey(billingPeriod.start);
|
|
129
129
|
} else if (dueDate instanceof Date) {
|
|
130
|
-
// "11 月对账单 due 12-25" → bill is for month BEFORE due
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
// "11 月对账单 due 12-25" → bill is for month BEFORE due.
|
|
131
|
+
// Build from (year, month-1, 1): a naive setMonth(getMonth()-1) keeps the
|
|
132
|
+
// day, so a due-day of 29-31 overflows into the wrong month (Mar 31 − 1mo
|
|
133
|
+
// → Feb 31 → rolls to Mar 3 → wrong "-03" instead of "-02"). Month -1
|
|
134
|
+
// (January → December prior year) is handled correctly by the Date ctor.
|
|
135
|
+
const prev = new Date(dueDate.getFullYear(), dueDate.getMonth() - 1, 1);
|
|
133
136
|
billingMonth = formatMonthKey(prev);
|
|
134
137
|
} else {
|
|
135
138
|
const m = (email.subject || "").match(/(\d{1,2})\s*月.*(?:对账单|月结|账单)/);
|
|
@@ -82,10 +82,15 @@ class TimelineSkill extends AnalysisSkill {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
async run(options = {}) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
// Default to the last 7 days only when the caller gave no window at all.
|
|
86
|
+
// The old `{ sinceDays: …, ...options }` merge injected sinceDays:7 ahead
|
|
87
|
+
// of resolveTimeWindow's since > sinceDays > sinceMonths precedence, so an
|
|
88
|
+
// explicit `sinceMonths: N` was silently shadowed into a 7-day window.
|
|
89
|
+
const hasWindow =
|
|
90
|
+
(typeof options.since === "number" && options.since > 0) ||
|
|
91
|
+
(typeof options.sinceDays === "number" && options.sinceDays > 0) ||
|
|
92
|
+
(typeof options.sinceMonths === "number" && options.sinceMonths > 0);
|
|
93
|
+
const window = this.resolveTimeWindow(hasWindow ? options : { sinceDays: 7 });
|
|
89
94
|
const limit = Number.isFinite(options.limit) && options.limit > 0
|
|
90
95
|
? Math.min(options.limit, 1000)
|
|
91
96
|
: 100;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlesschain/personal-data-hub",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.38",
|
|
4
4
|
"description": "Personal Data Hub — UnifiedSchema + validators + KG ingest helpers for the data-back-to-the-individual middleware",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "lib/index.js",
|