
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
temporal-react-hook
Advanced tools
A React library that provides hooks for handling date and time operations using the Temporal API
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.
npm install temporal-react-hook
or
yarn add temporal-react-hook
| 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 |
# 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/
The Temporal API is a modern JavaScript date/time API that addresses many of the shortcomings of the built-in Date object:
MIT
FAQs
A React library that provides hooks for handling date and time operations using the Temporal API
We found that temporal-react-hook demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.