Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@baiwusanyu/utils-date

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@baiwusanyu/utils-date

## Function

latest
Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
422
-28.72%
Maintainers
1
Weekly downloads
 
Created
Source

@baiwusanyu/utils-date

Function

setZeroDate

补0

参数参数类型默认值说明
numnumber-需要补 0 的数字
返回值返回类型说明
resstring补 0 结果

getLastDay

获取某个月最后一天

参数参数类型默认值说明
monthnumber-月份
yearnumbernew Date().getFullYear()年份
isFullbooleanfalse是否显示全日期,true 则返回 'YYYY-MM-DD',反之只返回一个数字
返回值返回类型说明
resstring \ number最后一天日期

formatDate

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

参数参数类型默认值说明
timestring-时间
formatstringYYYY-MM-DD HH:mm:ss格式
返回值返回类型说明
resstring格式结果

relativeTime

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

参数参数类型默认值说明
rTimestring-待比较时间
cTimestring-待比较时间
isBeforebooleantrue返回 xxx前xxx后
unitunitOfTime.StartOfhour单位
langstringzh-cn国际化
返回值返回类型说明
resstring相对时间结果

Keywords

typescript

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts