@baiwusanyu/utils-date

Function
46,728 3
Install
npm install @baiwusanyu/utils-date
Latest Version:1.1.2
License:MIT
Last Updated:Dec 12, 2024
Links: GitHub  ·  npm
Maintainer: baiwusanyu

@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 相对时间结果

Related Packages

Version History

Version Released License
1.1.2 MIT
1.1.1 MIT
1.1.0 MIT
1.0.18 MIT
1.0.17 MIT