Easy International Analog Clock Component – Clock.js

Category: Date & Time , Javascript | May 13, 2023
Author:matthewp
Views Total:294 views
Official Page:Go to website
Last Update:May 13, 2023
License:MIT

Preview:

Easy International Analog Clock Component – Clock.js

Description:

A lightweight JS component that allows you to embed an animated analog clock displaying the current local time on your web page.

You can specify a custom time zone offset if you want to show time for a different region.

How to use it:

1. Import the clock.js as a module.

import { AnalogClock } from '/path/to/clock.js';
// OR
<script type="module" src="../clock.js"></script>

2. Add the <analog-clock /> component to the page. That’s it.

<analog-clock></analog-clock>

3. Customize the time zone offsets to display any time zone of your choice.

<analog-clock offset="-5"></analog-clock>

4. Generate a static clock that does not update.

<analog-clock time="timestamp here"></analog-clock>

You Might Be Interested In:


Leave a Reply