
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
date-cipher
Advanced tools
二次封装的时间计算快捷函数使用库
/**
* @method formatDate 简单的格式化日期格式
*
* @param {Date} date 需要被格式化的日期
* @param {String} formatStr 格式化字符串
*
* @return {String} 返回格式化好的日期
*/
使用方式 =>
import { formatDate } from 'date-cipher'
console.log(formatDate())
/**
* @method s2eWeek 计算周的起止时间
*
* @param {Date} date 任意一天
* @param {String} formatStr 格式化字符串
* @param {Boolean} isCurrent 结束时间为当前时间
*
* @return {Object} 返回起止日期
*/
使用方式 =>
import { s2eWeek } from 'date-cipher'
console.log(s2eWeek())
/**
* @method s2eMonth 计算月的起止时间
*
* @param {Date} date 任意一天
* @param {String} formatStr 格式化字符串
* @param {Boolean} isCurrent 结束时间为当前时间
*
* @return {Object} 返回起止日期
*/
使用方式 =>
import { s2eMonth } from 'date-cipher'
console.log(s2eMonth())
/**
* @method s2eYear 计算年的起止时间
*
* @param {Date} date 任意一天
* @param {String} formatStr 格式化字符串
* @param {Boolean} isCurrent 结束时间为当前时间
*
* @return {Object} 返回起止日期
*/
使用方式 =>
import { s2eYear } from 'date-cipher'
console.log(s2eYear())
/**
* @method dayByDays 计算N天前或者N天后的日期
*
* @param {Date} date 一年中任意一天
* @param {String} formatStr 格式化字符串
* @param {Number} days 计算天数
* @param {String} type 计算的是之前的日期 before 之后的日期 after
*
* @return {Object} 默认返回昨天日期
*/
使用方式 =>
import { dayByDays } from 'date-cipher'
console.log(dayByDays())
/**
* @method s2eDayByDays 计算N天前或者N天后的日期(起止日期)
*
* @param {String} formatStr 格式化字符串
* @param {Number} days 计算天数
* @param {String} type 计算的是之前的日期 before 之后的日期 after
* @param {Boolean} isCurrent 是否包含今天
*
* @return {Object} 默认返回最近一周的起止日期
*/
使用方式 =>
import { s2eDayByDays } from 'date-cipher'
console.log(s2eDayByDays())
/**
* @method diffDays 计算两个时间段的相差天数,精确到 N 年 N 天 精确到小数后两位
*
* @param {Date} startDate 开始时间
* @param {Date} endDate 结束时间
* @param {Boolean} format 是否进行格式化,为 true 格式化成 N 年 N 天,为 false 直接返回未格式化的
*
* @return {String} 相差的天数
*/
使用方式 =>
import { diffDays } from 'date-cipher'
console.log(diffDays())
FAQs
The npm package date-cipher receives a total of 2 weekly downloads. As such, date-cipher popularity was classified as not popular.
We found that date-cipher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.