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

country-live-clocks

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-live-clocks - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

CONTRIBUTING.md

23

index.js

@@ -323,14 +323,17 @@ /**

*/
function getCountryLiveClock(countryCode) {
if (!countryCode) throw new Error("Country Code is required");
const timezonesForCountry = getTimezonesForCountry(countryCode.toUpperCase());
if (!timezonesForCountry?.length) throw new Error("Invalid Country Code");
return timezonesForCountry.slice(0, 5).map(({ name: timezone }) => ({
timezone,
time: new Date().toLocaleTimeString('en-US', { timeZone: timezone, hour12: true, timeStyle: 'short' })
}));
async function getCountryLiveClock(countryCode) {
return new Promise((resolve, reject) => {
if (!countryCode) reject(new Error("Country Code is required"));
const timezonesForCountry = getTimezonesForCountry(countryCode.toUpperCase());
if (!timezonesForCountry?.length) reject(new Error("Invalid Country Code"));
const result = timezonesForCountry.slice(0, 5).map(({ name: timezone }) => ({
timezone,
time: new Date().toLocaleTimeString('en-US', { timeZone: timezone, hour12: true, timeStyle: 'short' })
}));
resolve(result);
});
}
module.exports = getCountryLiveClock;
{
"name": "country-live-clocks",
"version": "1.0.1",
"description": "Country Live Clock is a versatile npm package designed to provide real-time timezone information for any country. By simply passing a country code, users can retrieve an array of objects detailing the current time across all the time zones within that country. Whether you're building applications that require accurate global time display, scheduling software that spans multiple time zones, or just need a quick way to check the time in different parts of a country, Country Live Clock offers a straightforward and efficient solution.",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ankitjha-webdev/CountryLiveClocks.git"
},
"keywords": [
"time zones",
"country time",
"world clock",
"timezone converter",
"timezone",
"local time",
"global clock",
"country code",
"time API",
"live clock",
"time utility",
"international time",
"timezone lookup",
"country timezone",
"clock",
"React",
"Vue",
"Angular",
"Node.js",
"JavaScript",
"frontend",
"backend",
"web development"
],
"author": "Ankit Kumar <ankitjha-webdev@example.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ankitjha-webdev/CountryLiveClocks/issues"
},
"homepage": "https://github.com/ankitjha-webdev/CountryLiveClocks#readme"
}
"name": "country-live-clocks",
"version": "1.0.2",
"description": "Country Live Clock is a versatile npm package designed to provide real-time timezone information for any country. By simply passing a country code, users can retrieve an array of objects detailing the current time across all the time zones within that country. Whether you're building applications that require accurate global time display, scheduling software that spans multiple time zones, or just need a quick way to check the time in different parts of a country, Country Live Clock offers a straightforward and efficient solution.",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ankitjha-webdev/CountryLiveClocks.git"
},
"keywords": [
"time zones",
"country time",
"world clock",
"timezone converter",
"timezone",
"local time",
"global clock",
"country code",
"time API",
"live clock",
"time utility",
"international time",
"timezone lookup",
"country timezone",
"clock",
"React",
"Vue",
"Angular",
"Node.js",
"JavaScript",
"frontend",
"backend",
"web development"
],
"author": "Ankit Kumar <ankitjha-webdev@example.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ankitjha-webdev/CountryLiveClocks/issues"
},
"homepage": "https://github.com/ankitjha-webdev/CountryLiveClocks#readme"
}

@@ -15,6 +15,7 @@ # Country Live Clocks

bash
npm install country-live-clocks
```bash
foo@bar:~$ npm install country-live-clocks
0 vulnerabilities
```
## Usage

@@ -24,12 +25,12 @@

javascript
```javascript
const { getCountryLiveClock } = require('country-live-clocks');
// Replace 'US' with the country code you're interested in
getCountryLiveClock('US').then(timezones =&gt; {
getCountryLiveClock('US').then(timezones => {
console.log(timezones);
}).catch(error =&gt; {
}).catch(error => {
console.error('Error fetching timezones:', error);
});
```
## API

@@ -36,0 +37,0 @@

Sorry, the diff of this file is not supported yet

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