0.2.2 • Published 8 months ago

@neetohq/timezones v0.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@neetohq/timezones

npm version license

A simple and lightweight NPM package for working with time zones. This package provides a human friendly timezone selector and utility functions for timezones.

Installation

You can install the package using npm:

npm install @neetohq/timezones

NeetoTimezoneSelector

Check out the live demo

import { NeetoTimezoneSelector } from "@neetohq/timezones";

new NeetoTimezoneSelector(document.getElementById("elementId"));

Configuration

You can pass options as the second parameter to configure the timezone selector component.

  1. elementId: ID for the NeetoTimezoneSelector. By default the ID will be timezone-selector
  2. className: Custom classes that can be added to the component.
  3. onChange: Function to be called when the timezone selector changes.
  4. position: Position in which the selector should open in. Available options: top, bottom. Default position is bottom.
  5. onHourFormatChange: Function to be called when the time format changes.
import { NeetoTimezoneSelector } from "@neetohq/timezones";

new NeetoTimezoneSelector(document.getElementById("elementId"), {
  className: "custom-selector-class",
  onChange: (timezone) => {
    console.log(timezone);
  },
  elementId: "custom-selector-element",
  position: "top",
});

ianaTimezoneToHumanReadble

import { ianaTimezoneToHumanReadable } from "@neetohq/timezones";

ianaTimezoneToHumanReadable("Asia/Calcutta") // => Indian Standard Time

ianaTimezoneToHumanReadable("America/New_York") // => Eastern Standard Time

ianaTimezoneToHumanReadable("Europe/Berlin") // => Central Standard Time

Development

Clone the repo

git clone git@github.com:neetohq/neeto-timezones.git
cd neeto-timezones/js
pnpm install
pnpm dev

Publishing to npm

  1. Bump package.json version
  2. Commit and push
  3. pnpm build && pnpm publish
0.2.2

8 months ago

0.2.1

8 months ago

0.2.0

9 months ago

0.1.9

9 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago