1.0.5 • Published 4 years ago

forenoon v1.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

时间日期格式化工具

安装

npm i foremoon --save
npm install

引入

const foremoon = require('foremoon')
或
import foremoon from 'foremoon'

使用方法

  • 格式化时间
    foremoon.fmtDateArea(options)
    options参数:

    参数名格式默认值说明
    date'2019年11月23日 17:42:19' 或者 1577094139529new Date()传日期形式需要传入字符串,时间戳要转成Number
    fmtTypefullfull返回格式:2019-11-23 18:18:58
    ymd年月日,返回格式:2019-11-23
    hms时分秒,返回格式:18:22:04
    chn中文年月日,返回格式:2019年11月23日 18:22:33
    connector-、/-年月日连接符
  • 获取一段时间

    foremoon.fmtDateArea(type, fmtType)

    type 参数

    参数名返回值
    week '2019-12-22', '2019-12-28'
    month '2019-12-01', '2019-12-31'
    year'2019-01-01', '2019-12-31' ]

    fmtType 参数:

    参数名返回值
    'YYYY-MM-DD' '2019-12-22', '2019-12-28'
    'YYYY/MM/DD' '2019/12/22', '2019/12/28'

    fmtType的参数可参照momentjs格式

  • 获取N天前的日期

    foremoon.datePreEnd(dayCount, type='day', fmtType)

    示例:

    foremoon.datePreEnd(7, 'day', 'YYYY-MM-DD')
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago