New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@deepjs/date

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepjs/date

date utils

latest
npmnpm
Version
0.2.9
Version published
Maintainers
1
Created
Source

date

日期相关格式处理

独立包,无依赖

功能列表

  • formatNum
  • formatDate
  • formatCountDown => genCountdownStr
  • genCountdownObj
  • genSplitorObj

使用

import {
  formatNum,
  formatDate,
  formatCountDown, // 计划废弃,请使用 genCountdownStr 替代
  genCountdownStr,
  genCountdownObj,
  genSplitorObj,
} from '@deepjs/date'

const format = 'd天H:F:S'

formatNum(0) // 00
formatCountDown(10000) // '00:00:10'

// 新方法
genCountdownStr(9000) // '00:00:09'
genCountdownObj(9000)
// { d: 0, H: '00', h: 0, F: '00', f: 0, S: '09', s: 9 }
genSplitorObj(format)
// { H: ':', F: ':', S: ''}
genSplitorObj('d天 H时f分S秒')
// {d: '天 ', H: '时', f: '分', S: '秒'}


const date = +new Date('2018-12-17 19:04:09');
formatDate(date)                  // '2018年12月17日'
formatDate(date, 'M-D')           // '12-17'
formatDate(date, 'Y-M-D H:F:S')   // '2018-12-17 19:04:09'

Keywords

date

FAQs

Package last updated on 17 Sep 2020

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