Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

aheenam/vue-dashboard-clock

Repository files navigation

A Vue component that display the current time

This package provides a simple Vue component that renders the current date and time of a given timezone.

This package is meant to be used for the Aheenam Dashboard but you can use this package for your project as well.

Installation

Simply add this package using npm/yarn

# using yarn
yarn add aheenam-dashboard-clock

# using npm
npm i -S aheenam-dashboard-clock

Usage

This package includes one component Clock. You can import it in your application and the add it to the list of components. Now you can use it in your template.

<template>
  <div>
    <clock />
  </div>
</template>

<script>
import { Clock } from 'aheenam-dashboard-clock'

export default {
  // ...
  components: {
    Clock
  }
  // ...
}
</script>

Timezone

By default the component uses Europe/Berlin as its timezone. You can change this by providing a timezone prop.

<clock timezone="AMERICA/LOS_ANGELES" />

Format Output of Date and Time

You can modify the output of the time and the date by providing the props dateFormat and timeFormat

By default dateFormat is ddd MM/DD and timeFormat defaults to HH:mm:ss

<clock timeFormat="HH:mm" dateFormat="DD.MM.YYYY" />

As this packages uses moment.js for handling time and dates, refer to its documentation for more details on format values.

Changelog

Check CHANGELOG for the changelog

Testing

To run tests use

yarn test

Contributing

soon

Security

If you discover any security related issues, please email [email protected] or use the issue tracker of GitHub.

About Aheenam

Aheenam is a small company from NRW, Germany creating custom digital solutions. Visit our website to find out more about us.

License

The MIT License (MIT). Please see License File for more information.