@baiwusanyu/utils-date
TypeScript icon, indicating that this package has built-in type declarations

1.0.18 • Public • Published

@baiwusanyu/utils-date

Function

setZeroDate

补0

参数 参数类型 默认值 说明
num number - 需要补 0 的数字
返回值 返回类型 说明
res string 补 0 结果

getLastDay

获取某个月最后一天

参数 参数类型 默认值 说明
month number - 月份
year number new Date().getFullYear() 年份
isFull boolean false 是否显示全日期,true 则返回 'YYYY-MM-DD',反之只返回一个数字
返回值 返回类型 说明
res string \ number 最后一天日期

formatDate

给定一个时间(2023-04-27T07:32:39.000+00:00),返回指定格式日期字符串

参数 参数类型 默认值 说明
time string - 时间
format string YYYY-MM-DD HH:mm:ss 格式
返回值 返回类型 说明
res string 格式结果

relativeTime

给定两个个时间(2023-04-27T07:32:39.000+00:00),返回相对时间

参数 参数类型 默认值 说明
rTime string - 待比较时间
cTime string - 待比较时间
isBefore boolean true 返回 xxx前xxx后
unit unitOfTime.StartOf hour 单位
lang string zh-cn 国际化
返回值 返回类型 说明
res string 相对时间结果

Package Sidebar

Install

npm i @baiwusanyu/utils-date

Weekly Downloads

1,172

Version

1.0.18

License

MIT

Unpacked Size

18.1 kB

Total Files

7

Last publish

Collaborators

  • baiwusanyu