Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

sd-browser-date

shuidifed5ISC1.3.0

水滴前端公共工具库

date, utils

readme

date

date方法库

Usage

const dateUtils = require('sd-browser-date')

// 获取对象值
dateUtils.getYear() // 2019

支持的API

名称 描述
getYear 获取年份
getMonth 获取月份
getDate 获取日
getHour 获取小时
getMinute 获取分钟
getSecond 获取秒
getMillisecond 获取毫秒
getDay 获取星期
dateFormat 时间格式化
getTimestamp 获取毫秒时间戳
getSecondTimestamp 获取秒级时间戳
getDaysInMonth 返回当前月份的天数
getDiff 获取时间差,默认为秒差值
isSame 比较两个时间是否相同,默认精度为秒
isLeapYear 判断是否为闰年