npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

phone-number-to-timezone

v1.0.8

Published

Get details about area,timezone,etc based on number, we have used https://www.chronomouse.com/ client side js library to make it available at server side too

Downloads

6,137

Readme

phone-number-to-timezone

phone-number-to-timezone is a utility that helps to get the current time and location for a phone number, area code, or country code.

We have used Chronomouse client-side js library to make it available at server side too.

Get information such as the current time, GMT offset time zone name, location, the capital city, daylight savings laws, or daylight savings status.

Currently supports US & Canada Area Codes and all Country Codes.

Getting Started

install with npm:

$ npm install phone-number-to-timezone

Examples

console.log ( getLocalInfo('+1809*******'));

 { text: '809',
  options: { military: true, zone_display: 'offset' },
  time:
   { zone: 'GMT-4',
     hour: '06',
     mins: '10',
     meridian: false,
     display: '06:10' },
  type: 'area',
  offset: -5,
  dst: true,
  country_info:
   { name: 'United States',
     code: '1',
     capital: 'Washington, DC',
     offset: -5,
     dst: true,
     start_month: 2,
     start_week: 2,
     start_offset: false,
     start_day: 0,
     end_month: 10,
     end_week: 1,
     end_day: 0 },
  location: 'Dominican Republic',
  dstnow: true }

Properties

getLocalInfo( string area/country code,function callback);

Input text must start with '+' or '00' to trigger country code search.

var obj = getLocalInfo('615');

obj.text - string. The input text for the area or country code.

obj.location - string. For area codes, the name of the major city for that area followed by state abbreviation. Country codes, the name of the country.

console.log( getLocalInfo('415').location );
// San Francisco, CA

console.log( getLocalInfo('+55').location );
// Brazil

obj.valid - boolean. True, if a matching code was found in the time info arrarys. If false, other properties will may falsy (undefined or false).

obj.dst - boolean. If country has Daylight Savings laws. NOT an indication of Daylight Savings being currently active. Note: DST Laws are subject to change and would require updating codearrays.js.

obj.dstnow - boolean. If Daylight Savings is currently in effect. Note: DST Laws are subject to change and would require updating codearrays.js.

obj.offset - number. Offset of the zone without calculating daylight savings.

obj.type - string. Distinguishes area from country code. Will return either 'area' or 'country'.

obj.country_info - obj. Contains info about the country. See further properties below. If US/Canada Country Code, returns info for US.

obj.country_info.code - string. Country calling code, i.e. '55'.

obj.country_info.capital - string. Capital city.

obj.country_info.dst - boolean. If country has Daylight Savings laws. NOT an indication of Daylight Savings being currently active.

obj.country_info.offset - number. GMT Offset.

obj.options - obj. Received input options. More on passing options below.

obj.options.military - boolean. If 24-hour time is set. Default true.

obj.options.zone_display - string. 'name' or 'offset'. Default 'name'.

obj.time - obj. Contains info about the current time.

obj.time.display - string. Current time in hh:mm format. If miltary time is set to false, then this will include the meridian (AM/PM).

     console.log ( getLocalInfo('615').time.display );
     // 8:45 AM

obj.time.hour - string. Current hour.

obj.time.hour2 - string. For split US/Canada time zones - the current hour of the time zone immediately east.

obj.time.mins - string. Current minutes.

obj.time.meridian - string. Current meridian (AM/PM).

obj.time.meridian2 - string. For split time zones - the other meridian for hour2.

obj.time.zone - string. Time zone, displayed as the name of the time zone, or as the GMT offset, depending on the options. The default is 'offset' and is displayed in format "GMT+/-[offset]".

     console.log ( getLocalInfo('615').time.zone );
     // GMT-5

zone_display - string. Sets obj.zone_display. Can be 'name' OR 'offset'. Displays zone by zone name or GMT offset. Default 'offset'.

console.log ( getLocalInfo('615',{zone_display: 'area'}).time.zone );
// CST
console.log ( getLocalInfo('615',{zone_display: 'offset'}).time.zone );
// GMT-5

License

This project is licensed under the MIT License - see the LICENSE.md file for details