# @xuanmo/datejs

> ## 安装

Latest version **1.0.15** (published 2023-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xuanmo/datejs
pnpm add @xuanmo/datejs
yarn add @xuanmo/datejs
bun add @xuanmo/datejs
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.15 |
| Published | 2023-04-03 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | xuanmo |
| Maintainers | xuanmo |
| Keywords | date |

## Links

- npm: https://www.npmjs.com/package/@xuanmo/datejs
- Repository: https://github.com/xuanmos/datejs
- Homepage: https://github.com/xuanmos/datejs#readme
- Issues: https://github.com/xuanmos/datejs/issues
- npm.io page: https://npm.io/package/@xuanmo/datejs

## 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.15 (latest) — 2023-04-03
- 1.0.14 — 2023-03-26
- 1.0.13 — 2023-03-26
- 1.0.12 — 2023-03-26
- 1.0.11 — 2023-03-25
- 1.0.10 — 2023-03-25
- 1.0.9 — 2022-07-24
- 1.0.8 — 2022-05-26
- 1.0.7 — 2022-01-02
- 1.0.6 — 2021-07-19
- 1.0.5 — 2021-07-18
- 1.0.4 — 2021-07-18
- 1.0.3 — 2019-11-18
- 1.0.2 — 2019-11-18
- 1.0.1 — 2019-11-18
- … 1 more at https://npm.io/package/@xuanmo/datejs/versions

## README

# Datejs 简易版时间格式化

## 安装

```
yarn add @xuanmo/datejs
or
npm i @xuanmo/datejs
```

## 使用

```js
import datejs from '@xuanmo/datejs'

// 默认当前时间，格式：yyyy-MM-dd HH:mm:ss
datejs().format()

// 可传入一个时间作为被转换时间
datejs(new Date('2019-10-10 19:00:00')).format()

// 完整示例
datejs(new Date('2019-11-17 09:00:00')).format('yyyy-MM-dd hh:mm:ss CW')
```

## 可格式化规则

规则|描述|是否补零|结果示例
:-:|:-:|:-:|:-:
yyyy|年||2019
MM|月||09
M|月|Y|9
dd|日||01
d|日|Y|1
HH|时，24小时制||23
H|时，24小时制|Y|23
hh|时，12小时制||01
h|时，12小时制|Y|1
mm|分||01
m|分||1
ss|秒||01
s|秒|Y|01
W|周||1
CW|周||星期一

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