# wjq-time

> 第一次上传npm包

Latest version **1.0.0** (published 2022-09-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install wjq-time
pnpm add wjq-time
yarn add wjq-time
bun add wjq-time
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-09-08 |
| First published | 2022-09-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | wangjianquan |
| Keywords | time, format |

## Links

- npm: https://www.npmjs.com/package/wjq-time
- npm.io page: https://npm.io/package/wjq-time

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-09-08

## README

## 安装

```
npm install wjq-time

```

## 导入

```js
const format = require('./wjq-time');

```

## 格化时间的功能

```js
// 调用 initTime 对时间进行格式化
const dtStr = format.initTime(new Date())
// 结果 2022-9-08 11:32:53
console.log(dtStr)

```

## 转义 HTML 中的特殊字符

```js
// 调用 toString 对时间进行格式化
const dtString = format.toString('<h1 style="color: red;">哈哈</h1>')
// 转为结果 &lt;h1 style=&quot;color: red;&quot;&gt;哈哈&lt;/h1&gt;
console.log(dtString)

```

## 将特殊字符转义为 HTML

```js
// 调用 toString 对时间进行格式化
const dtHtml = format.toHtml('&lt;h1 style=&quot;color: red;&quot;&gt;哈哈&lt;/h1&gt;')
// 转为结果 <h1 style="color: red;">哈哈</h1>
console.log(dtHtml)

```

## 开源协议
ISC

---
_Source: https://npm.io/package/wjq-time · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
