@ethisyscore/core-utils

中文文档
1.157.1发布于 2026/10/18Apache-2.0TypeScriptESM + CJS近 30 天下载 3800

Framework-agnostic utilities shared by the EthisysCore monolith and plugins: date/time/duration helpers (over date-fns), RFC 6902 JSON Patch generate/apply (over mutative), and list-response envelope normalisation. Pure TypeScript; no React or MUI. The da

此软件包已被标记为弃用

This package has moved to the Ethisys Core package feed. In Ethisys Core, open the Developers page and follow the setup steps (cc login connects npm to the feed).

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. What's inside ( ./date )
  4. Scripts

@ethisyscore/core-utils

Framework-agnostic utilities shared by the EthisysCore monolith and plugins. Pure TypeScript — no React, no MUI. Utilities are grouped by domain: date (date/time formatting incl. the org-format seam), patch, list, money (currency display incl. compact abbreviation), and number (plain-number and percentage display). Import a group via its sub-path (e.g. @ethisyscore/core-utils/money, @ethisyscore/core-utils/number) or pull everything from the umbrella entry.

Install

npm install @ethisyscore/core-utils

date-fns is a runtime dependency. dayjs is an optional peer dependency — only needed if you import the ./date/dayjs sub-path.

Usage

// Everything (umbrella entry)
import { formatDateSafe, dateOnlyToIsoUtc, formatDurationNumber } from "@ethisyscore/core-utils";

// Or import the date group directly
import { addDaysToIsoDate, toHHmmss } from "@ethisyscore/core-utils/date";

// dayjs-backed picker helper (requires dayjs)
import { dayjsToIsoDayBoundary } from "@ethisyscore/core-utils/date/dayjs";

What's inside (./date)

AreaExports
Format constantsDATE_FORMAT, DISPLAY_DATE_FORMAT, AUDIT_DATE_FORMAT, DAY_DATE_FORMAT, DAY_MONTH_FORMAT, DAY_MONTH_YEAR_FORMAT, TIME_FORMAT, SHORT_DATETIME_FORMAT
ISO / timezone-safeisDateOnlyString, formatDate, getTodayIsoDate, getMonthStartIso, getMonthEndIso, parseIsoDateLocal, addDaysToIsoDate, toDateOnlyString
Display formattingformatDateString, formatDateSafe, formatDateWithOrdinal, formatTimeAgo
Duration / timespantimespanToMilliseconds, millisecondsToHours, hoursToMilliseconds, formatMillisecondsAsTimeSpent, formatDuration, formatDurationNumber, toHHmm, toHHmmss
Wire boundary (<input> ⇄ .NET DateTimeOffset)isoToDateInput, dateInputToIso, dateOnlyToIsoUtc, nowLocalDateTimeInputValue, localDateTimeInputToIsoUtc, isoUtcToLocalDateTimeInput, ensureUtcIso
Ranges / timezonegetDateRange, computeDateRange, currentMonthRangeUtc, getCurrentOffsetMinutes
dayjs sub-pathdayjsToIsoDayBoundary

The wire-boundary helpers exist to bridge the naive local strings emitted by <input type="date"> / <input type="datetime-local"> to full ISO-8601 UTC, avoiding the offset/DST drift that occurs when a .NET DateTimeOffset endpoint reinterprets a no-suffix timestamp as UTC.

Scripts

npm run build   # tsup → ESM + CJS + d.ts
npm test        # vitest
npm run lint    # tsc --noEmit

版本与发布记录

@ethisyscore/core-utils 共发布 206 个版本,首次发布于 2026/06/25;过去 12 个月发布了 206 个版本。

版本发布日期距今
1.157.1latest2026/10/1826 天前
1.157.02026/10/1827 天前
1.156.22026/10/1727 天前
1.156.12026/10/1727 天前
1.156.02026/10/1727 天前
1.155.02026/10/1628 天前

关于 @ethisyscore/core-utils 的常见问题

@ethisyscore/core-utils 是什么?

Framework-agnostic utilities shared by the EthisysCore monolith and plugins: date/time/duration helpers (over date-fns), RFC 6902 JSON Patch generate/apply (over mutative), and list-response envelope normalisation. Pure TypeScript; no React or MUI. The da注意:该包已被作者标记为弃用——This package has moved to the Ethisys Core package feed. In Ethisys Core, open the Developers page and follow the setup steps (cc login connects npm to the feed).

如何安装 @ethisyscore/core-utils?

在项目目录运行 npm install @ethisyscore/core-utils,或使用 pnpm add / yarn add / bun add。

@ethisyscore/core-utils 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ethisyscore/core-utils 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ethisyscore/core-utils 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ethisyscore/core-utils 可以商用吗?

@ethisyscore/core-utils 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@ethisyscore/core-utils 的下载量有多少?

根据 npm 官方下载统计,@ethisyscore/core-utils 在 2026/10/14 – 2026/11/12 这 30 天内被下载 3,800 次,日均约 127 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ethisyscore/core-utils 还在维护吗?

最新版本 1.157.1 发布于 2026/10/18(26 天前);至今共发布 206 个版本,其中过去 12 个月发布了 206 个;首次发布于 2026/06/25。作者已将其标记为弃用,新项目建议寻找替代方案。