> For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/llms-full.txt.

# Temporal Instant

将 `timezone` 和 `fractionalDays` 直接放在调度器 config 顶层，例如 `config: { ...modelConfig, timezone: 'Asia/Tokyo', fractionalDays: false }`。省略这两个字段时使用默认值 `'UTC'` 和 `false`。直接调用预设需要完整配置：`temporalInstantChrono.create({ config: { timezone: 'Asia/Tokyo', fractionalDays: false } })`；通过调度器创建实例时会校验配置并补齐默认值。

`fractionalDays: false` 表示按指定时区计算日历日期差；设为 `true` 时，时间差包含该时区下的小数天数。`add` 在 UTC 下使用固定 24 小时，在其他时区下按日历天计算；跨越夏令时切换时，当地的一天可能短于或长于 24 小时。增加小数天数时，使用相邻当地日的实际长度。此预设不提供自定义每日换日时间。

## 运行预设

在应用中安装 `temporal-polyfill`。示例在创建 Chrono 前导入全局入口，仅在执行环境没有原生 Temporal 时安装 polyfill；第二条 import 提供全局 TypeScript 类型声明。


```sh [npm]
npm install temporal-polyfill
```

```sh [yarn]
yarn add temporal-polyfill
```

```sh [pnpm]
pnpm add temporal-polyfill
```

```sh [bun]
bun add temporal-polyfill
```

```sh [deno]
deno add npm:temporal-polyfill
```

```ts twoslash file="../../../snippets/run-code/chrono-temporal.ts"
import 'temporal-polyfill/global'
import 'temporal-polyfill/types/global'
import { temporalInstantChrono } from 'ts-fsrs'

const clock = temporalInstantChrono.create({
  config: { timezone: 'America/New_York', fractionalDays: false },
})
const fractionalClock = temporalInstantChrono.create({
  config: { timezone: 'America/New_York', fractionalDays: true },
})

// Noon in New York, the day before daylight saving time starts.
const from = Temporal.Instant.from('2026-03-07T17:00:00Z')
const next = clock.add(from, 1)
const halfDay = clock.add(from, 0.5)

console.log(
  JSON.stringify(
    {
      nextDayUTC: next.toString(),
      elapsedHours: from.until(next).total('hours'),
      calendarDays: clock.difference(from, next),
      fractionalDays: fractionalClock.difference(from, halfDay),
    },
    null,
    2
  )
)

```


▶ 运行代码

纽约 3 月 7 日中午对应 17:00 UTC。增加一个当地日历天后，是 3 月 8 日中午，即 16:00 UTC；由于进入夏令时，实际只经过 23 小时。`fractionalDays: true` 将半天的增量计算为 `0.5`。
