Date|string|number
|required|[`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) or timestamp in the future|
129 | |[**key**](#key)|string|number
|`undefined`|React [`key`](https://reactjs.org/docs/lists-and-keys.html#keys); can be used to restart the countdown|
130 | |[**daysInHours**](#daysinhours)|`boolean`|`false`|Days are calculated as hours|
131 | |[**zeroPadTime**](#zeropadtime)|`number`|`2`|Length of zero-padded output, e.g.: `00:01:02`|
132 | |[**zeroPadDays**](#zeropaddays)|`number`|`zeroPadTime`|Length of zero-padded days output, e.g.: `01`|
133 | |[**controlled**](#controlled) |`boolean`|`false`|Hands over the control to its parent(s)|
134 | |[**intervalDelay**](#intervaldelay)|`number`|`1000`|Interval delay in milliseconds|
135 | |[**precision**](#precision)|`number`|`0`|The precision on a millisecond basis|
136 | |[**autoStart**](#autostart)|`boolean`|`true`|Countdown auto-start option|
137 | |[**overtime**](#overtime) |`boolean`|`false`|Counts down to infinity|
138 | |[**children**](#children)|`any`|`null`|A React child for the countdown's completed state|
139 | |[**renderer**](#renderer)|`function`|`undefined`|Custom renderer callback|
140 | |[**now**](#now)|`function`|`Date.now`|Alternative handler for the current date|
141 | |[**onMount**](#onmount)|`function`|`undefined`|Callback when component mounts|
142 | |[**onStart**](#onstart)|`function`|`undefined`|Callback when countdown starts|
143 | |[**onPause**](#onpause)|`function`|`undefined`|Callback when countdown pauses|
144 | |[**onStop**](#onstop)|`function`|`undefined`|Callback when countdown stops|
145 | |[**onTick**](#ontick)|`function`|`undefined`|Callback on every interval tick (`controlled` = `false`)|
146 | |[**onComplete**](#oncomplete)|`function`|`undefined`|Callback when countdown ends|
147 |
148 | ### `date`
149 | The `date` prop is the only required one and can be a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object, `string`, or timestamp in the future. By default, this date is compared with the current date, or a custom handler defined via [`now`](#now).
150 |
151 | Valid values can be _(and more)_:
152 | * `'2020-02-01T01:02:03'` // [`Date` time string format](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#Date_Time_String_Format)
153 | * `1580518923000` // Timestamp in milliseconds
154 | * `new Date(1580518923000)` // [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object
155 |
156 | ### `key`
157 | This is one of React's internal component props to help identify elements throughout the reconciliation process. It can be used to restart the countdown by
158 | passing in a new `string` or `number` value.
159 |
160 | Please see [official React docs](https://reactjs.org/docs/lists-and-keys.html#keys) for more information about keys.
161 |
162 | ### `daysInHours`
163 | Defines whether the time of day should be calculated as hours rather than separated days.
164 |
165 | ### `controlled`
166 | Can be useful if the countdown's interval and/or date control should be handed over to the parent. In case `controlled` is `true`, the
167 | provided [`date`](#date) will be treated as the countdown's actual time difference and not be compared to [`now`](#now) anymore.
168 |
169 | ### `zeroPadTime`
170 | This option defaults to `2` in order to display the common format `00:00:00` instead of `0:0:0`. If the value is higher than `2`, only the hours part _(see [`zeroPadDays`](#zeropaddays) for days)_ will be zero-padded while it stays at `2` for minutes as well as seconds. If the value is lower, the output won't be zero-padded like the example before is showing.
171 |
172 | ### `zeroPadDays`
173 | Defaults to `zeroPadTime`. It works the same way as [`zeroPadTime`](#zeropadtime) does, just for days.
174 |
175 | ### `intervalDelay`
176 | Since this countdown is based on date comparisons, the default value of `1000` milliseconds is probably enough for most scenarios and doesn't need to be changed.
177 |
178 | However, if it needs to be more precise, the `intervalDelay` can be set to something lower - down to `0`, which would, for example, allow showing the milliseconds in a more fancy way (_currently_ only possible through a custom [`renderer`](#renderer)).
179 |
180 | ### `precision`
181 | In certain cases, you might want to base off the calculations on a millisecond basis. The `precision` prop, which defaults to `0`, can be used to refine this calculation. While the default value simply strips the milliseconds part (e.g., `10123`ms => `10000`ms), a precision of `3` leads to `10123`ms.
182 |
183 | ### `autoStart`
184 | Defines whether the countdown should start automatically or not. Defaults to `true`.
185 |
186 | ### `overtime`
187 | Defines whether the countdown can go into overtime by extending its lifetime past the targeted endpoint. Defaults to `false`.
188 |
189 | When set to `true`, the countdown timer won't stop when hitting 0, but instead becomes negative and continues to run unless paused/stopped. The [`onComplete`](#oncomplete) callback would still get triggered when the initial countdown phase completes.
190 |
191 | > Please note that the [`children`](#children) prop will be ignored if `overtime` is `true`. Also, when using a custom [`renderer`](#renderer), you'll have to check one of the [render props](#render-props), e.g., `total`, or `completed`, to render the overtime output.
192 |
193 | ### `children`
194 | This component also considers the child that may live within the `overtime
)
52 | {JSON.stringify(props, null, 2)}} 60 | /> 61 |