Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ export default {

You can stop the countdown timer anytime by passing `true` (Boolean) with `stop` props.

You can decide whether to show the days when they are zero by passing `true` (Boolean) with `showZeroDays` props.

Example:

```
<div class="days-remaining">
<Countdown :end="timerEnd" :showZeroDays="true"></Countdown>
</div>
```

### Caution

Please don't provide any confusing date format since it has no dependency to Moment.js or any other date helpers.
Please don't provide any confusing date format since it has no dependency to Moment.js or any other date helpers.
11 changes: 9 additions & 2 deletions src/Countdown.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<ul class="vuejs-countdown">
<li v-if="days > 0">
<li v-if="displayDays">
<p class="digit">{{ days | twoDigits }}</p>
<p class="text">{{ days > 1 ? 'days' : 'day' }}</p>
</li>
Expand Down Expand Up @@ -33,7 +33,11 @@ export default {
},
stop: {
type: Boolean
}
},
showZeroDays: {
type: Boolean,
default: false
},
},
data() {
return {
Expand Down Expand Up @@ -73,6 +77,9 @@ export default {

days() {
return Math.trunc(this.diff / 60 / 60 / 24)
},
displayDays() {
return this.showZeroDays || this.days > 0
}
},
watch: {
Expand Down