Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ixnode/simple-clock

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ixnode/simple-clock

A simple, updating clock component for React.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@ixnode/simple-clock

Release npm version TypeScript MIT License

A simple, customizable, and responsive clock component for React.

🚀 Features

  • Customizable size and color
  • Supports both digital and analog clocks
  • Displays date, time zone and milliseconds
  • Configurable 12-hour and 24-hour formats
  • Lightweight and built with TypeScript
  • Build on top with storybook

📦 Installation

npm install @ixnode/simple-clock

or

yarn add @ixnode/simple-clock

🔧 Usage

Basic Usage

Basic clock.

import React from 'react';
import { Clock } from '@ixnode/simple-clock';
import '@ixnode/simple-clock/dist/styles.css';

const App = () => (
    <Clock size="large" color="blue" showDate={true} showBorder={true} showTimeZone={true} />
);

export default App;

More complex usage

Analog clock.

import React from 'react';
import { Clock } from '@ixnode/simple-clock';
import '@ixnode/simple-clock/dist/styles.css';

const App = () => (
    <Clock color={'default'} size={'small'} isAnalog={true} timeZone={"Europe/Berlin"} locale={"de-DE"} />
);

export default App;

🔧 Props

PropTypeDefaultDescription
color'default'|'red'|'green'|'blue''default'Sets the color of the clock.
size'small'|'medium'|'large''medium'Sets the size of the clock.
showBorderbooleanfalseWhether to show a border around the clock.
use24HourFormatbooleantrueUse 24-hour format (true) or AM/PM (false).
showTenthsbooleanfalseShow tenth of a second?
isAnalogbooleanfalseShow an analog clock?
showDatebooleanfalseShow date?
showTimeZonebooleanfalseShould a timezone be displayed?
timeZoneType'short'|'long''short'Which type of timezone should be displayed?
localestring'en-US'Which locale should be displayed?
timeZonestring'UTC'Which time zone should be displayed?

Common locales (locale)

timeZone is used with the Intl.DateTimeFormat API:

LocaleDescription
en-USEnglish (United States)
en-GBEnglish (United Kingdom)
de-DEGerman (Germany)
es-ESSpanish (Spain)
fr-FRFrench (France)
it-ITItalian (Italy)
nl-NLDutch (Netherlands)
pl-PLPolish (Poland)
pt-BRPortuguese (Brazil)
ru-RURussian (Russia)
sv-SESwedish (Sweden)
zh-CNChinese (Simplified, China)
zh-TWChinese (Traditional, Taiwan)

Common Time Zone Formats and Examples (timeZone)

timeZone is used with the Intl.DateTimeFormat API:

1. Common Time Zone Strings (IANA-TZ Format)

These strings are based on the IANA Time Zone Database, which defines time zones used worldwide:

Time ZoneDescription
UTCCoordinated Universal Time
America/New_YorkEastern Standard Time (EST)
Europe/BerlinCentral European Time (CET)
Asia/TokyoJapan Standard Time (JST)
Australia/SydneyAustralian Eastern Time (AET)
Africa/CairoEast Africa Time (EAT)
Pacific/AucklandNew Zealand Standard Time (NZST)
2. Short Time Zone Formats (Offset-based)

These formats use the offset from UTC in hours and minutes. Examples:

Time ZoneDescription
GMTGreenwich Mean Time
+02:00Two hours ahead of UTC
-05:00Five hours behind UTC
3. Abbreviated Time Zone Codes

Note: These are not supported by the Intl API and are not standardized. However, many abbreviations are commonly used in practice, such as:

AbbreviationDescription
PSTPacific Standard Time (UTC-8)
CETCentral European Time (UTC+1)
ISTIndian Standard Time (UTC+5:30)

🛠 Development

Building the Project

To build the project locally:

npm run build

Running Storybook

View and develop components in isolation:

npm run storybook

Open: http://localhost:6006/

Storybook

📦 Publishing to npm

Build the project

npm run build

Verify the build

node dist/index.js

Bump the version

Update the version in the package.json, e.g., from 1.0.0 to 1.0.1, to create a new release:

npm version patch

Alternatively:

  • Use npm version minor for new features.
  • Use npm version major for breaking changes.

Publish the package

npm publish --access public

Verify the publication

Check the package on npm: https://www.npmjs.com/package/@ixnode/simple-clock.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Authors

🌟 Contributing

Contributions are welcome! Feel free to submit issues or pull requests to improve this project.

🤝 Acknowledgments

Special thanks to the open-source community for providing amazing tools like React, TypeScript, and Storybook.

Keywords

FAQs

Package last updated on 21 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc