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 🙏

© 2026 – Pkg Stats / Ryan Hefner

country-date

v1.0.5

Published

country-date is a easy-to-use library designed to retrieve date information with a country

Readme

country-date

Description

country-date is a simple and easy-to-use library to get date information based on country and timeZone. The main goal is to retrieve numerical data and formatted strings (YYYY-MM-DD and HH:MM:SS) for a specific country, with automatic timeZone assignment per country. It also provides manual timeZone specification.

The current version includes a getCountryDate function that handles all core functionality.

The basic lightweight version supports:

  • Getting current UTC date/time information
  • Getting current date/time information by country
  • Getting current date/time information by timeZone
  • Getting information from a specific object by country
  • Getting information from a specific object by timeZone
  • Adding/subtracting minutes, hours, days, months, and years to a date with country-specific results

Usage Examples:

const { getCountryDate } = require("country-date")

Get current UTC date/time

console.log(getCountryDate());
// countryDate value
{
  dateTime: 2025-03-10T01:55:44.216Z,
  date: '2025-03-09',
  hour: '22:55:44',
  segment: 'PM',
  timestamp: 1741571744216,
  country: '',
  numYear: 2025,
  numDay: 3,
  numMonth: 9,
  numHour: 22,
  numMin: 55,
  numSec: 44,
  timeZone: 'UTC',
  addDelta: [Function: addDelta]
}

Get current date/time by country

countryDate = getCountryDate({ country: "AR" });

// countryDate value
{
  dateTime: 2025-03-10T01:55:44.243Z,
  date: '2025-03-09',
  hour: '22:55:44',
  segment: 'PM',
  timestamp: 1741571744243,
  country: 'AR',
  numYear: 2025,
  numDay: 3,
  numMonth: 9,
  numHour: 22,
  numMin: 55,
  numSec: 44,
  timeZone: 'America/Argentina/Buenos_Aires',
  addDelta: [Function: addDelta]
}

Get current date/time by timeZone

Example for "America/Argentina/Mendoza". Will auto-complete the country.

countryDate = getCountryDate({ timeZone: "America/Argentina/Mendoza" })

// countryDate value
{
  dateTime: 2025-03-10T01:55:44.244Z,
  date: '2025-03-09',
  hour: '22:55:44',
  segment: 'PM',
  timestamp: 1741571744244,
  country: 'AR',
  numYear: 2025,
  numDay: 3,
  numMonth: 9,
  numHour: 22,
  numMin: 55,
  numSec: 44,
  timeZone: 'America/Argentina/Mendoza',
  addDelta: [Function: addDelta]
}

Get information from specific by country

countryDate = getCountryDate({
  date: new Date(1741569493719),
  country: "RU"
})

// countryDate value
{
  dateTime: 2025-03-10T01:18:13.719Z,
  date: '2025-03-09',
  hour: '22:18:13',
  segment: 'PM',
  timestamp: 1741569493719,
  country: 'RU',
  numYear: 2025,
  numDay: 3,
  numMonth: 9,
  numHour: 22,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}

Get information from specific by timeZone

countryDate = getCountryDate({
  date: new Date(1741569493719),
  timeZone: "Europe/Moscow",
});

// countryDate value
{
  dateTime: 2025-03-10T01:18:13.719Z,
  date: '2025-03-10',
  hour: '04:18:13',
  segment: 'AM',
  timestamp: 1741569493719,
  country: 'RU',
  numYear: 2025,
  numDay: 3,
  numMonth: 10,
  numHour: 4,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}

Get information with custom locales (see Date locales)

countryDate = getCountryDate({
  date: new Date(1741569493719),
  country: "AR",
  locales: "su"
})

// countryDate value
{
  dateTime: 2025-03-10T01:18:13.719Z,
  date: '9/3/2025',  //--> custom LocaleString date format
  hour: '22.18.13',  //--> custom LocaleString date format
  segment: 'PM',
  timestamp: 1741569493719,
  country: 'AR',
  numYear: 2025,
  numDay: 3,
  numMonth: 9,
  numHour: 22,
  numMin: 18,
  numSec: 13,
  timeZone: 'America/Argentina/Buenos_Aires', // *Auto with country incoming in options
  addDelta: [Function: addDelta]
}

addDelta function - Add/subtract time deltas

Allows adding minutes, hours, days, months, and years to a date and getting country-specific results. Returns a new countryDate with the operation applied to the original countryDate.

countryDate = getCountryDate({
date: new Date(1741569493719),
timeZone: "Europe/Moscow",
});
//countryDate value
{
  dateTime: 2025-03-10T01:18:13.719Z,
  date: '2025-03-10',
  hour: '04:18:13',
  segment: 'AM',
  timestamp: 1741569493719,
  country: 'RU',
  numYear: 2025,
  numDay: 3,
  numMonth: 10,
  numHour: 4,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}


console.log(dateCountryDate.addDelta(10, "minutes"));
//OUTPUT:
{
  dateTime: 2025-03-10T01:28:13.719Z,
  date: '2025-03-10',
  hour: '04:28:13',
  segment: 'AM',
  timestamp: 1741570093719,
  country: 'RU',
  numYear: 2025,
  numDay: 3,
  numMonth: 10,
  numHour: 4,
  numMin: 28,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}


console.log(dateCountryDate.addDelta(10, "h"));
//OUTPUT
{
  dateTime: 2025-03-10T11:18:13.719Z,
  date: '2025-03-10',
  hour: '14:18:13',
  segment: 'PM',
  timestamp: 1741605493719,
  country: 'RU',
  numYear: 2025,
  numDay: 3,
  numMonth: 10,
  numHour: 14,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}

console.log(dateCountryDate.addDelta(10, "d"));
//OUTPUT
{
  dateTime: 2025-03-20T01:18:13.719Z,
  date: '2025-03-20',
  hour: '04:18:13',
  segment: 'AM',
  timestamp: 1742433493719,
  country: 'RU',
  numYear: 2025,
  numDay: 3,
  numMonth: 20,
  numHour: 4,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}

console.log(dateCountryDate.addDelta(10, "mon"));
//OUTPUT
{
  dateTime: 2026-01-10T01:18:13.719Z,
  date: '2026-01-10',
  hour: '04:18:13',
  segment: 'AM',
  timestamp: 1768007893719,
  country: 'RU',
  numYear: 2026,
  numDay: 1,
  numMonth: 10,
  numHour: 4,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}

console.log(dateCountryDate.addDelta(10, "y"));
//OUTPUT
{
  dateTime: 2035-03-10T01:18:13.719Z,
  date: '2035-03-10',
  hour: '04:18:13',
  segment: 'AM',
  timestamp: 2057102293719,
  country: 'RU',
  numYear: 2035,
  numDay: 3,
  numMonth: 10,
  numHour: 4,
  numMin: 18,
  numSec: 13,
  timeZone: 'Europe/Moscow',
  addDelta: [Function: addDelta]
}

References

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones