0.3.1 • Published 6 months ago

vue-date-countdown v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Vue Date Countdown

Simple Vue 3 component for countdown to a specific date.

Install

NPM

npm install vue-date-countdown

Register locally in your component

import { DateCountdown } from 'vue-date-countdown';

export default {
    components: {
      DateCountdown
    }
};

Or register globally

import DateCountdown from 'vue-date-countdown';
import { createApp } from 'vue';

const app = createApp(App);

app.use(DateCountdown);

Usage

Use object from v-slot to get access to countdown values days, hours, minutes and hours:

<DateCountdown v-slot="date" :end-date="Date.now() + 60000">
  Before Birthday:
  {{ date.days }} days
  {{ date.hours }} hours
  {{ date.minutes }} minutes
  {{ date.seconds }} seconds
</DateCountdown>

Or get the values directly:

<DateCountdown
  v-slot="{ days, hours, minutes, seconds }"
  :end-date="Date.now() + 60000"
>
  {{ days }}:{{ hours }}:{{ minutes }}:{{ seconds }} before Birthday!
</DateCountdown>

props

- end-date

required The date on which the countdown will end

<DateCountdown :end-date="Date.now() + 60000" v-slot="date">
  {{ date.minutes }} min
</DateCountdown>

- start-date

The date from which the countdown began. By default, it's new Date()

<DateCountdown
  :start-date="Date.now()"
  :end-date="Date.now() + 60000"
  v-slot="date"
>
  {{ date.minutes }} min
</DateCountdown>

- end-text

Text that will be shown after the countdown ends

<DateCountdown
  :end-date="Date.now() + 60000"
  end-text="Countdown is over! Happy Birthday!"
  v-slot="date"
>
  {{ date.days }} days until Birthday...
</DateCountdown>

- always-show-days

Whether to show the days parameter if it is equal to 0. By default, it's false

Coming soon

  • More settings and customization

License

MIT License

0.3.0

6 months ago

0.3.1

6 months ago

0.2.5

7 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago

0.0.1

7 months ago