---
type: Basic
title: Time
subtitle: 时间
cols: 1
order: 4
---

```ts
import { BixiTableModule } from '@bixi/core/table';
```


## API

### bixi-time

| 成员 | 说明 | 类型 | 默认值 |
|----|----|----|-----|
| `[time]` | 时间戳 | `number | string | Date` | `0` |
| `[radio]` | 用于兼容不同时间精确度的 UNIX 时间戳，精确到毫秒无需配置，精确到秒需配置该参数为 1000 | `number` | `1` |
| `[format]` | 时间戳显示格式 | `string` | `YYYY/MM/DD HH:mm` |
| `[relative]` | 是否显示相对时间 | `boolean` | `true` |
| `[timeout]` | 超时时间(显示相对时间有效),指定超过多长时间后，数据不再刷新 | `number` | `24 * 60` |
| `[duration]` | 定时刷新(显示相对时间时有效)| `number` | `60` |

`radio` 用于兼容 UNIX 时间戳，默认精确到毫秒， 如果数据精确到秒，需要配置 `radio` 为 1000。

## 依赖

我们推荐基于 [dayjs](https://github.com/iamkun/dayjs/) 的时间处理，最大原因是它体积小功能却很强大。

```
yarn add dayjs
```

如果你需要显示相对时间还需要一个拓展 `relativeTime`

``` typescript
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
dayjs.extend(relativeTime);
```

## 国际化

在使用组件外层调用 [dayjs](https://github.com/iamkun/dayjs/) API

``` typescript
// 中文国际化
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
```
