Package Exports
- @vtils/date
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vtils/date) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

在 dayjs 基础上封装的常用日期操作类库。
https://fjc0k.github.io/vtils/date
安装
# yarn
yarn add @vtils/date
# or, npm
npm i @vtils/date --save你也可通过 CDN 安装,然后使用全局变量 vd 访问相关工具:
<script src="https://cdn.jsdelivr.net/npm/@vtils/date@2.57.0/lib/index.umd.min.js" crossorigin="anonymous"></script>目录
| 👇 | 👇 | 👇 | 👇 |
|---|---|---|---|
| formatDate | numeralDayToChineseDay | toDayjs |
列表
formatDate
格式化日期。
formatDate('2019-9-1', 'YYYY年M月D日') // => 2019年9月1日numeralDayToChineseDay
数字星期转中文星期。0 和 7 都视为星期日。
numeralDayToChineseDay(0) // => 日
numeralDayToChineseDay(1) // => 一
numeralDayToChineseDay(5) // => 五
numeralDayToChineseDay(7) // => 日toDayjs
转换输入的日期为 Dayjs 实例。
// 字符串
toDayjs('2019-9-1')
// Date 实例
toDayjs(new Date(2019, 8, 1))
// unix 时间戳
toDayjs(1569643555)
// Dayjs 实例
toDayjs(dayjs())许可
MIT ©️ Jay Fong