Countdown
Template for action cards containing a countdown
#
Usage// Countdown for 1 hour in the future (3600 seconds)<ActionCardCountdownTemplate countdownProps={{until: 3600}} onPress={() => console.log("Pressed 'Next' button")}/>
#
Specific DateUse the getSecondsUntil
function to easily get the seconds until a desired date.
caution
Month is 0-index e.g. January is 0 not 1. December is 11 not 12.
// Specific day of the year (Midnight)<ActionCardCountdownTemplate countdownProps={{until: new Date(YEAR, MONTH, DAY)}} onPress={() => console.log("Pressed 'Next' button")}/>
// Specific hour of the day<ActionCardCountdownTemplate countdownProps={{until: new Date(YEAR, MONTH, DAY, HOUR)}} onPress={() => console.log("Pressed 'Next' button")}/>
// Specific minute of the hour<ActionCardCountdownTemplate countdownProps={{until: new Date(YEAR, MONTH, DAY, HOUR, MINUTE)}} onPress={() => console.log("Pressed 'Next' button")}/>
// Specific time of the day<ActionCardCountdownTemplate countdownProps={{until: new Date(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND)}} onPress={() => console.log("Pressed 'Next' button")}/>
#
Epoch timeUsing epoch instead of an actual date.
<ActionCardCountdownTemplate countdownProps={{until: new Date(epoch * 1000)}} onPress={() => console.log("Pressed 'Next' button")}/>
note
Epoch timestamp is the epoch time in milliseconds instead of seconds.
#
Paused countdownPass the `paused: true
value to the countdownProps
// Countdown for 1 hour in the future (3600 seconds)<ActionCardCountdownTemplate countdownProps={{until: 3600, paused: true}} onPress={() => console.log("Pressed 'Next' button")}/>
#
PropsName | Type | Default | Description |
---|---|---|---|
countdownProps | ActionCardCountdownProps | undefined | Props passed to the bullet list. See props here |
onPress | function () => any | undefined | Callback that is called when pressing the 'next' button. |
*required