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

temporal-react-hook

v2.2.2

Published

A React library that provides hooks for handling date and time operations using the Temporal API

Readme

temporal-react-hook

A modern React library that provides hooks for handling date and time operations using the Temporal API. This library makes it easy to work with dates, times, time zones, durations, and relative times in React applications.

Live Demo

Installation

npm install temporal-react-hook

or

yarn add temporal-react-hook

Available Hooks

| Hook | Description | |------|-------------| | useTemporalDateTime | Get and manage current date and time with configurable updates | | useTimeZone | Work with time zones and convert between them | | useDuration | Create and manipulate time durations, with comparison and formatting | | useRelativeTime | Format dates as human-readable relative times with localization | | useLocaleDateTime | Format dates according to locale-specific conventions | | useTimeAgo | Display how long ago a date occurred | | useIsSame | Compare if two dates are the same (day, month, year, etc.) | | useIsBetween | Check if a date falls within a specified date range (e.g., useIsBetween({ date, startDate, endDate })) | | useDifference | Calculate the numerical difference between two dates in a specified unit | | useIsToday | Check if a date is today | | useIsThisWeek | Check if a date is in the current week | | useIsThisMonth | Check if a date is in the current month | | useIsThisYear | Check if a date is in the current year | | useTemporalAdd | Add time units to a date | | useTemporalSubtract | Subtract time units from a date | | useTemporalFormat | Format dates with custom patterns | | useTemporalStartOf | Get the start of a time unit (day, week, month, etc.) | | useTemporalEndOf | Get the end of a time unit (day, week, month, etc.) | | useTimeZoneOffset | Get the current UTC offset for a time zone, auto-updates on DST | | useDateTimeRange | Manage a date-time range with ordering, clamping, and helper functions | | useGetDaysInYear | Get the number of days in the year for a given date (365 or 366 for leap years) | | useParseISO | Parse an ISO-8601 date-time string into a Temporal.PlainDateTime instance |

Running the Demo Locally

# Clone the repository
git clone https://github.com/vlad-grigoryan/temporal-react-hook.git
cd temporal-react-hook

# Install dependencies
npm install

# Start the demo
cd demo
npm install
npm start

The demo will be available at http://localhost:5173/temporal-react-hook/

Why Temporal API?

The Temporal API is a modern JavaScript date/time API that addresses many of the shortcomings of the built-in Date object:

  • Immutable date/time objects
  • First-class time zone support
  • Calendar-aware date manipulation
  • Explicit handling of time zones and calendars
  • Clear distinction between wall-clock time and exact time

License

MIT