@viccydev/pi-fpa 0.6.1 → 0.6.2
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/README.md
CHANGED
|
@@ -127,12 +127,12 @@ pi list
|
|
|
127
127
|
团队分发建议使用固定 Git tag:
|
|
128
128
|
|
|
129
129
|
```bash
|
|
130
|
-
pi install git:github.com/linyqh/pi-fpa@v0.6.
|
|
130
|
+
pi install git:github.com/linyqh/pi-fpa@v0.6.2
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
## 发布到 npm
|
|
134
134
|
|
|
135
|
-
发布动作由 GitHub Release 触发。Release 标签必须严格使用 `v<package.json version>`,例如版本 `0.6.
|
|
135
|
+
发布动作由 GitHub Release 触发。Release 标签必须严格使用 `v<package.json version>`,例如版本 `0.6.2` 对应 `v0.6.2`。工作流会检出该标签,执行 `npm ci`、`npm test` 和包内容预检,全部通过后发布公开包 `@viccydev/pi-fpa`。普通 Release 发布到 `latest`,Prerelease 发布到 `next`。
|
|
136
136
|
|
|
137
137
|
发布认证使用 npm Trusted Publishing / OIDC,不使用长期 npm Token。npm 包后台的 Trusted Publisher 配置为:
|
|
138
138
|
|
|
@@ -153,6 +153,10 @@ function addDay(date: string): string {
|
|
|
153
153
|
return value.toISOString().slice(0, 10);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
function canonicalTimezone(timezone: string): string {
|
|
157
|
+
return new Intl.DateTimeFormat("en-US", { timeZone: timezone }).resolvedOptions().timeZone;
|
|
158
|
+
}
|
|
159
|
+
|
|
156
160
|
function approximatelyEqual(left: number, right: number): boolean {
|
|
157
161
|
return Math.abs(left - right) <= Math.max(0.000001, Math.max(Math.abs(left), Math.abs(right)) * 0.000001);
|
|
158
162
|
}
|
|
@@ -209,7 +213,7 @@ export function projectCycleOperatingProjection(input: CycleOperatingProjectionI
|
|
|
209
213
|
const receipt = input.execution === undefined ? undefined : execution(input.execution, current);
|
|
210
214
|
const next = input.next_forecast === undefined ? undefined : forecast(input.next_forecast, "next_forecast");
|
|
211
215
|
if (next && (Date.parse(next.target_period.start_inclusive) !== Date.parse(current.target_period.end_exclusive)
|
|
212
|
-
|| next.target_period.timezone !== current.target_period.timezone)) {
|
|
216
|
+
|| canonicalTimezone(next.target_period.timezone) !== canonicalTimezone(current.target_period.timezone))) {
|
|
213
217
|
throw new Error("next_forecast target period must be the exact successor of the current cycle in the same timezone.");
|
|
214
218
|
}
|
|
215
219
|
if (next && next.reporting_currency !== current.reporting_currency) throw new Error("next_forecast reporting_currency must match current_forecast.");
|