# countdown22222

> 倒计时-countdown

Latest version **1.0.3** (published 2016-07-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install countdown22222
pnpm add countdown22222
yarn add countdown22222
bun add countdown22222
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-07-15 |
| First published | 2016-07-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | guoxuemin |
| Maintainers | guoxmin |
| Keywords | 倒计时 |

## Links

- npm: https://www.npmjs.com/package/countdown22222
- npm.io page: https://npm.io/package/countdown22222

## Recent versions

- 1.0.3 (latest) — 2016-07-15

## README

#倒计时（解决运行时间长后时间不同步问题）
update

- format支持Function格式，返回时间对象，this指向对应倒计时DOM

## 注意

<p style="font-size:30px;color:#f00; font-weight:bold;">**注意!**各服务器时间不同,需动态获取项目所部署的服务器时间。</p> 依赖jquery或zepto， 具体[查看demo](demo.html)


	
	
## 使用

>**html结构**

	<div class="countdown" data-startDate="11/8/2015 16:21:00" data-endDate="11/9/2015 18:50:10"></div>

>**js调用（依赖jquery或zepto）**

	$(".countdown").countdown({
        rootTime:timeStamp,
		// d:h:m:s（默认）、h:m:s、m:s
        timeFormat:"h:m:s",
        willbe:{
            //format:'<span>距离开始时间还有:</span><span>{day}</span> 天 <span>{hour}</span> 时 <span>{min}</span> 分 <span>{sec}</span> 秒',
			//or
			format:function(time){
				if(time.hour>5){
                            
                }else{
                    
                }
                
                $(this).html('<span>距离开始时间还有:</span><span>'+time.day+'</span> 天 <span>'+time.hour+'</span> 时 <span>'+time.min+'</span> 分 <span>'+time.sec+'</span> 秒');
			},

            callback:function(){}
        },
        start:{
            format:'',
            callback:function(){}
        },
        end:{
            format:'',
            callback:function(){}
        }
    })

>**参数设置**

- **rootTime** {String||Number} 项目服务器的时间戳（ms）
- **timeFormat** {String} 时间格式,三种:d:h:m:s（默认）、h:m:s、m:s
- **willbe**{Object} 即将开始
- **start** {Object}开始
- **end** {Object} 结束
- **format** {String||Function} 显示格式
- **callback** {Function} 回调函数 


>**获取服务器时间接口要求**

- 注意，每台服务器时间不同，需换成项目所部署服务器的接口
- 支持callback形式，方便jsonp跨域请求
- 返回时间的毫秒数


参考:[http://zzsvn.pcauto.com.cn/svn/other/doc/common/countdown/getTime.php?callback=fn](http://zzsvn.pcauto.com.cn/svn/other/doc/common/countdown/getTime.php?callback=fn)

>**[点击查看demo](demo.html "点击查看demo")**

---
_Source: https://npm.io/package/countdown22222 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
