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

world-timestamp

v1.0.1

Published

Provides UTC (or any timezone) time in milliseconds and microseconds from https://worldtimeapi.org/.

Downloads

9

Readme

world-timestamp

Provides UTC (or any timezone) time in microseconds and milliseconds from https://worldtimeapi.org.

  • Totally independent of the local system clock.
  • Capable of next.js, nuxt.js or any react projects.
  • Supports various timezones. (See worldtimeapi/timezones)

Installation

$ npm install world-timestamp

Usage

import worldTimestamp from 'world-timestamp';

const getUTCTimestamp = async () => {
    // const timestamp = await worldTimestamp(); // "Etc/UTC" as default
    const timestamp = await worldTimestamp("Asia/Tokyo");

    console.log(timestamp.response); // returns worldtimeapi.org response
    console.log(timestamp.response.datetime); // Ex. 2022-10-01T18:00:00.123456+09:00

    console.log(timestamp.milliseconds); // 1664614800123.456
    console.log(timestamp.utcMilliseconds); // 1664647200123.456

    console.log(timestamp.microseconds); // 1664614800123456
    console.log(timestamp.utcMicroseconds); // 1664647200123456
};

References

worldTimestamp(timezone?: string): Promise<WorldTimestamp>

| Parameter | Type | Description | | :--- | :--- | :--- | | timezone | string | Timezone. Default: "Etc/UTC" |

You can find all available timezones here: https://worldtimeapi.org/timezones

WorldTimestamp

| Property | Type | Description | | :--- | :--- | :--- | | response | WorldTimeApiResponse | Worldtimeapi.org response | | milliseconds | number | Timestamp in milliseconds | | utcMilliseconds | number | Timestamp in milliseconds in UTC | | microseconds | number(intager) | Timestamp in microseconds | | utcMicroseconds | number(intager) | Timestamp in microseconds in UTC |

WorldTimeApiResponse

| Property | Type | Description | | :--- | :--- | :--- | | abbreviation | string | Abbreviation of the timezone | | client_ip | string | Client IP address | | datetime | string | Timestamp in ISO 8601 format | | day_of_week | number | Day of the week | | day_of_year | number | Day of the year | | dst | boolean | Is daylight saving time in effect? | | dst_from | string | Date daylight saving time starts | | dst_offset | number | Daylight saving time offset | | dst_until | string | Date daylight saving time ends | | raw_offset | number | Timezone offset from UTC including daylight saving time | | timezone | string | Timezone | | unixtime | number | Timestamp in seconds | | utc_datetime | string | Timestamp in ISO 8601 format in UTC | | utc_offset | string | Timezone offset from UTC | | week_number | number | Week number |

see more in https://worldtimeapi.org/pages/schema

License

MIT License © 2022 MugiSus

Feel free to contact me if you have any questions or suggestions.