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

@kakilangit/unix-time

v0.2.0

Published

WebAssembly bindings for Unix Time Converter tool

Readme

@kakilangit/unix-time

WebAssembly bindings for Unix Time Converter tool.

Overview

This package provides Unix timestamp conversion functionality compiled to WebAssembly from Rust. It converts timestamps between various formats and timezones with support for the full IANA timezone database.

Installation

npm install @kakilangit/unix-time

Usage

import init, { 
  convert_unix_time, 
  get_current_timestamp_seconds, 
  get_current_timestamp_millis,
  get_available_timezones,
  TimeUnit 
} from '@kakilangit/unix-time';

// Initialize the WASM module
await init();

// Convert a Unix timestamp (seconds)
const result = convert_unix_time("1705315800", TimeUnit.Seconds, "UTC");
console.log(result.unix_seconds);    // 1705315800
console.log(result.unix_millis);     // 1705315800000
console.log(result.utc_iso);         // "2024-01-15T12:30:00Z"
console.log(result.utc_rfc2822);     // "Mon, 15 Jan 2024 12:30:00 GMT"

// Localized time with timezone info
console.log(result.localized.timezone);       // "UTC"
console.log(result.localized.abbreviation);   // "UTC"
console.log(result.localized.offset);         // "+0000"
console.log(result.localized.datetime);       // "2024-01-15 12:30:00"
console.log(result.localized.iso);            // "2024-01-15T12:30:00+00:00"

// Date/time components
console.log(result.localized.components.year);        // 2024
console.log(result.localized.components.month);       // 1
console.log(result.localized.components.day);         // 15
console.log(result.localized.components.hour);        // 12
console.log(result.localized.components.minute);      // 30
console.log(result.localized.components.second);      // 0
console.log(result.localized.components.weekday);     // "Mon"
console.log(result.localized.components.month_name);  // "Jan"

// Convert with different timezone
const nyTime = convert_unix_time("1705315800", TimeUnit.Seconds, "America/New_York");
console.log(nyTime.localized.offset); // "-0500"

// Convert milliseconds
const millisResult = convert_unix_time("1705315800123", TimeUnit.Millis, "UTC");

// Get current timestamps
const nowSeconds = get_current_timestamp_seconds();
const nowMillis = get_current_timestamp_millis();

// List available timezones
const timezones = get_available_timezones();
console.log(timezones); // ["UTC", "America/New_York", "Europe/London", ...]

API

Functions

convert_unix_time(timestamp, unit, timezone)

Converts a Unix timestamp to human-readable formats.

  • timestamp (string): The timestamp value as string
  • unit (TimeUnit): The unit of the timestamp
  • timezone (string): IANA timezone identifier (e.g., "UTC", "America/New_York")

Returns TimeResult:

  • original: Original input timestamp
  • unix_seconds: Unix timestamp in seconds
  • unix_millis: Unix timestamp in milliseconds
  • utc_iso: UTC time in ISO 8601 format
  • utc_rfc2822: UTC time in RFC 2822 format
  • localized: Localized time display object
    • timezone: Timezone IANA identifier
    • abbreviation: Timezone abbreviation (e.g., "EST", "CET")
    • offset: Offset from UTC (e.g., "+0100", "-0500")
    • datetime: Formatted date and time (YYYY-MM-DD HH:MM:SS)
    • iso: ISO 8601 format with offset
    • rfc2822: RFC 2822 format
    • components: Individual date/time components
      • year, month, day, hour, minute, second
      • weekday: Short weekday name (e.g., "Mon")
      • month_name: Short month name (e.g., "Jan")

get_current_timestamp_seconds()

Returns the current Unix timestamp in seconds.

get_current_timestamp_millis()

Returns the current Unix timestamp in milliseconds.

get_available_timezones()

Returns all available IANA timezone identifiers from the bundled database.

Enums

TimeUnit

  • Seconds = 0 - Seconds since Unix epoch (January 1, 1970)
  • Millis = 1 - Milliseconds since Unix epoch

Timezone Support

This package includes the full IANA timezone database, supporting:

  • All global timezones (UTC, GMT, etc.)
  • Regional timezones (America/New_York, Europe/London, Asia/Tokyo, etc.)
  • Historical timezone data and DST transitions

Features

  • Accurate timestamp conversion using jiff library
  • Full IANA timezone database support
  • Automatic DST handling
  • Multiple output formats (ISO 8601, RFC 2822, components)
  • WASM-compatible time retrieval via JavaScript Date

License

MIT