šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@bigbinary/neeto-time-zones

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bigbinary/neeto-time-zones

![npm version](https://img.shields.io/npm/v/@bigbinary/neeto-time-zones.svg) ![license](https://img.shields.io/npm/l/@bigbinary/neeto-time-zones.svg)

0.8.1
latest
npm
Version published
Weekly downloads
2.2K
-24.15%
Maintainers
3
Weekly downloads
Ā 
Created
Source

@bigbinary/neeto-time-zones

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 yarn:

yarn add @bigbinary/neeto-time-zones

Importing CSS styles to the main stylesheet

You should add the following to main.scss file:

@import "@bigbinary/neeto-time-zones/dist/style.css";

NeetoTimezoneSelector

Check out the live demo

Usage 1

import { NeetoTimezoneSelector } from "@bigbinary/neeto-time-zones";

const ReactComponent = () => {
  const timezoneRef = useCallback(node => {
    if (!(node !== null)) return;

    new NeetoTimezoneSelector(node, {
      elementId: "custom-selector-element",
      className: "custom-selector-class",
      initialValue: "initial-timezone",
      position: "top",
      onChange: (timezone) => {
        console.log(timezone);
      },
      onHourFormatChange: (timeFormat) => {
        console.log(timeFormat);
      }
    });
  }, []);

  return (
    <div
      ref={timezoneRef}
    />
  );
};

Usage 2

import NeetoTimezoneSelector from "@bigbinary/neeto-time-zones/react";

const ReactComponent = () => {
  return (
    <NeetoTimezoneSelector
      elementId="custom-selector-element"
      className="custom-selector-class"
      initialValue="initial-timezone"
      position="top"
      onChange={(timezone) => {
        console.log(timezone);
      }}
      onHourFormatChange={(timeFormat) => {
        console.log(timeFormat);
      }}
    />
  );
}

Configuration

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

  • elementId: ID for the NeetoTimezoneSelector. By default the ID will be timezone-selector
  • className: Custom classes that can be added to the component.
  • initialValue: Initial Value of the timezone selector.
  • position: Position in which the selector should open in. Available options: top, bottom. Default position is bottom.
  • onChange: Function to be called when the timezone selector changes.
  • onHourFormatChange: Function to be called when the time format changes.
  • isTimeFormatSwitchVisible: Setting this to false will hide the time format toggle. The default value is true.
  • isTimeFormat24H: When the internal time format toggle is disabled, use this prop to pass the time format option. This will be used to change the time format inside the timezone selector.

ianaTimezoneToHumanReadable

import { ianaTimezoneToHumanReadable } from "@bigbinary/neeto-time-zones";

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:bigbinary/neeto-time-zones.git
cd neeto-timezones/js
yarn install
yarn dev

Instructions for Publishing

A package is released upon merging a PR labeled as patch, minor, or major into the main branch. The patch label addresses bug fixes, minor signifies the addition of new features, and major denotes breaking changes, adhering to the principles outlined in Semantic Versioning (SemVer).

You can checkout the Create and publish releases workflow in GitHub Actions to get a live update.

FAQs

Package last updated on 15 May 2025

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