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

format-timestamp

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-timestamp

格式化时间戳

latest
Source
npmnpm
Version
0.0.8
Version published
Maintainers
1
Created
Source

Installation

npm install format-timestamp --save

Usage

import formatTimestamp from 'format-timestamp';

/**
 *  @param timestamp:时间戳,毫秒
 *  @param isDibit:当小于10,补0
 *  @param flag:标志,如:'minutes',格式化分钟,秒,毫秒;可设置为'days', 'hours', 'minutes', 'seconds', 
 *  'milliseconds',默认为'days'
 *  @result {Object}
 */

const result = formatTimestamp(60*60*1000*25 + 60*1000 + 8000, true, 'days');

// 倒计时剩余1天1小时1分8秒
window.console.log(`倒计时剩${result.days}天${result.hours}:${result.minutes}:${result.seconds}`);

Keywords

countdown

FAQs

Package last updated on 15 Oct 2018

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