1.0.27 • Published 6 years ago
react-sexy-countdown v1.0.27
react-sexy-countdown
Install
npm i --save react-sexy-countdown
Import
import Countdown from 'react-sexy-countdown'
##Support this date&time format only
2018-05-29T07:00:00+07:00
Can use moment-timezone for convert format
const dateFormat = moment.tz(1527552000000, 'Asia/Bangkok').format()
console.log(dateFormat); //2018-05-29T07:00:00+07:00
Config props
Props | Type | Default | Format Example |
---|---|---|---|
date | String | Date.now() | 2018-05-29T07:00:00+07:00 |
onEndCountdown | Func | null | (count) => console.log(count) |
lang | String | en | "th" or "en" |
displayText | Object | {} | { Days: 'Days', Day: 'Day', Hours: 'Hours', Min: 'Min', Sec: 'Sec' } |
lastTextTime | Object | {} | set text after number countdown example: { Day: 'D', Hours: 'H', Min: 'M', Sec: 'S' } |
beforeTextTime | Object | {} | set text before number countdown example: { Day: 'D', Hours: 'H', Min: 'M', Sec: 'S' } |
isDayDoubleZero | Boolean | true | "00 : 00 : 00 : 00" if true "0 : 00 : 00 : 00" |
isHoursDoubleZero | Boolean | true | "00 : 00 : 00 : 00" if true "00 : 0 : 00 : 00" |
isMinDoubleZero | Boolean | true | "00 : 00 : 00 : 00" if true "00 : 00 : 0 : 00" |
isSecDoubleZero | Boolean | true | "00 : 00 : 00 : 00" if true "00 : 00 : 00 : 0" |
using
<Countdown
date="2018-05-29T07:00:00+07:00"
onEndCountdown={ (count) => console.log(count) }
lang="th"
displayText={{
Days: 'วัน',
Day: 'วัน',
Hours: 'ชั่วโมง',
Min: 'นาที',
Sec: 'วินาที',
}}
lastTextTime={{
Day: 'D'
}}
isDayDoubleZero={ true }
/>
Style (with className for you custom style)
<div className="react-countdown-container">
<div className="react-countdown-box">
<div className="react-countdown-element">
<div className="react-countdown-time-text">Day</div>
<div className="react-countdown-time">
<span className="react-countdown-before-text-day">is</span>
12
<span className="react-countdown-last-text-day">D</span>
</div>
</div>
</div>
<div className="react-countdown-box">
<div className="react-countdown-element">
<div className="react-countdown-time-text">Houts</div>
<div className="react-countdown-time">
<span className="react-countdown-before-text-hours">is</span>
12
<span className="react-countdown-last-text-hours">H</span>
</div>
</div>
</div>
<div className="react-countdown-box">
<div className="react-countdown-element">
<div className="react-countdown-time-text">Min</div>
<div className="react-countdown-time">
<span className="react-countdown-before-text-min">is</span>
12
<span className="react-countdown-last-text-min">M</span>
</div>
</div>
</div>
<div className="react-countdown-box">
<div className="react-countdown-element">
<div className="react-countdown-time-text">Sec</div>
<div className="react-countdown-time">
<span className="react-countdown-before-text-sec">is</span>
12
<span className="react-countdown-last-text-sec">S</span>
</div>
</div>
</div>
</div>
1.0.27
6 years ago
1.0.26
6 years ago
1.0.25
6 years ago
1.0.24
6 years ago
1.0.23
6 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.19
6 years ago
1.0.18
6 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago