# @georges-tech/tardis 中文文档

规范地址：https://npmcn.com/package/%40georges-tech/tardis/

版本：1\.2\.2
npm 元数据更新时间：2025-03-07T09:00:29.999Z
中文译文更新时间：2026-11-16T04:50:43.780Z
软件包许可：未声明

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40georges-tech/tardis
原文对照：https://npmcn.com/package/%40georges-tech/tardis/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：35 kB，11 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：^16
- 运行依赖：2 个
- 首次发布：2020-10-19T14:39:45.624Z
- 最新版本发布：2025-03-07T09:00:29.798Z
- 近 30 天下载量：8457（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：7（近 12 个月 0 个）

## 中文简介

读取神化数据的时间属性执行

## 安装

```sh
npm install @georges-tech/tardis
```

也可以使用：`pnpm add @georges-tech/tardis`、`yarn add @georges-tech/tardis`、`bun add @georges-tech/tardis`

## README

# 塔地丝

[临时财产](https://martinfowler.com/eaaDev/TemporalProperty.html) 执行情况 读取所显示的数据.

![](https://i.imgur.com/jbnaqkx.png)

## 安装

```
npm install @georges-tech/tardis
```

## 使用量

您通过 Tardis 创建服务 `createHistoryService` 通过提供一系列文档 **必须** 包含 下列属性:

```ts
  /**
   * Date at which the configuration starts to be valid
   */
  effective_date: Date;

  /**
   * Date at which the new configuration has been created
   */
  known_at: Date;

  /**
   * Optional end date for limited time configurations 
   */
  end_date?: Date;
```

您可以随意添加多少属性, 取决于您的使用大小写, 这些属性会被服务返回 .

文件可包含一个计算公式 `end_date`,是下一个有效的文件日期,如果它存在。 否则,它 实值 `undefined`。 。 。 .

在创建服务时,您可以提供相关时间段的工作日期.

## 示例

```ts
import tardis from '@georges-tech/tardis';

const documents = [{
  effective_date: new Date('2020-01-01'),
  known_at: new Date('2020-05-01'),
  data: {
    value: 'old',
  }
}, {
  effective_date: new Date('2020-03-01'),
  known_at: new Date('2020-10-01'),
  data: {
    value: 'new',
  }
}]
const historyService = tardis.createHistoryService({ documents });

const januaryConfiguration = historyService.getConfigurationAtDate({ date: new Date('2020-01-03') });
// januaryConfiguration.data.value = 'old'
// januaryConfiguration.end_date = new Date('2020-03-01')

const mayConfiguration = historyService.getConfigurationAtDate({ date: new Date('2020-05-03') });
// mayConfiguration.data.value = 'new'
// mayConfiguration.end_date = undefined
```

### 特定日期

```ts
import tardis from '@georges-tech/tardis';

const documents = [{
  effective_date: new Date('2020-01-01'),
  known_at: new Date('2020-05-01'),
  data: {
    value: 'old',
  }
}, {
  effective_date: new Date('2020-03-01'),
  known_at: new Date('2020-10-01'),
  data: {
    value: 'new',
  },
  {
  effective_date: new Date('2020-04-01'),
  known_at: new Date('2020-12-01'),
  data: {
    value: 'new 2',
  }
}]
const historyService = tardis.createHistoryService({ documents, date: new Date('2020-11-01') });

const januaryConfiguration = historyService.getConfigurationAtDate({ date: new Date('2020-01-03') });
// januaryConfiguration.data.value = 'old'
// januaryConfiguration.end_date = new Date('2020-03-01')

const mayConfiguration = historyService.getConfigurationAtDate({ date: new Date('2020-05-03') });
// mayConfiguration.data.value = 'new'
// mayConfiguration.end_date = undefined
// Here we keep the configuration known on 01/10 because on the given date we did not yet know the "new2" configuration

```

## 常见问题

### @georges-tech/tardis 是什么？

读取神化数据的时间属性执行

### 如何安装 @georges-tech/tardis？

在项目目录运行 npm install @georges-tech/tardis，或使用 pnpm add / yarn add / bun add。

### @georges-tech/tardis 支持 TypeScript 吗？

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

### @georges-tech/tardis 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @georges-tech/tardis 需要什么版本的 Node\.js？

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

### @georges-tech/tardis 可以商用吗？

@georges-tech/tardis 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @georges-tech/tardis 的下载量有多少？

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

### @georges-tech/tardis 还在维护吗？

最新版本 1\.2\.2 发布于 2025/03/07（1\.7 年前）；至今共发布 7 个版本，其中过去 12 个月发布了 0 个；首次发布于 2020/10/19。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

