date-fns-tz

IANA time zone support for date-fns, powered by the native Intl API with zero bundled time zone data.

Library
npm
v3.2.0
1,181stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture85
Code Quality82
Innovation84
Learning Curve80

date-fns-tz is a complementary library for date-fns that adds first-class IANA time zone handling on top of the plain JavaScript Date objects date-fns works with. It leans on the browser and Node.js Intl API to resolve time zone offsets and names, so no multi-megabyte time zone database needs to ship in your bundle.

It provides a small set of focused helpers: format a date in any target time zone, convert between UTC and a zoned wall-clock time, and read the offset for a given zone and instant. This makes it straightforward to display and accept times in a fixed time zone regardless of where a user or server actually is.

What You Get

  • A formatInTimeZone helper that renders any date in a specified IANA zone regardless of the system time zone, with full z..zzzz token support.
  • Conversion helpers fromZonedTime and toZonedTime to move between UTC instants and zoned wall-clock Date values.
  • A getTimezoneOffset helper returning the UTC offset in milliseconds for a zone and instant, correctly accounting for DST.
  • Both CommonJS and native ESM entry points, plus an fp functional-programming variant of every function.

Common Use Cases

  • Displaying an event’s start time in the venue’s local time zone to users anywhere in the world.
  • Converting a date picker value plus a selected IANA zone into the correct UTC instant to send to a server.
  • Rendering server-provided UTC timestamps as local wall-clock times for a specific target zone.
  • Formatting timestamps with proper short/long time zone names like EST or Eastern Standard Time.

Under The Hood

Architecture — The public surface is a handful of pure functions organized one-per-directory under src/ (formatInTimeZone, fromZonedTime, toZonedTime, getTimezoneOffset, format, toDate), each re-exported from src/index.ts. The core of the time zone logic lives in src/_lib, where tzParseTimezone resolves an offset for a zone and instant, tzTokenizeDate and tzIntlTimeZoneName call the Intl DateTimeFormat API to extract zone parts and names, and newDateUTC/getTimezoneOffsetInMilliseconds handle the arithmetic. toZonedTime parses the input via toDate, computes the offset through tzParseTimezone, and shifts the Date so its local getters reflect the target zone; formatInTimeZone composes toZonedTime with the extended format. Tech Stack — Written in TypeScript, compiled to both CommonJS and ESM via two tsconfig targets, with date-fns (^3.0.0 || ^4.0.0) as the sole peer dependency. It relies entirely on the platform Intl API for zone data, so it carries no runtime dependencies of its own. Tooling is ESLint, Prettier, Karma for the browser test runner, and CircleCI. Code Quality — Every function directory ships a co-located test.js, and shared internals under _lib each have their own test suite, indicating solid coverage of the offset and formatting logic. Source files carry detailed JSDoc with @throws contracts and worked examples, and the code favors small pure functions with explicit RangeError/TypeError handling for invalid dates and zones. API Design — The API is deliberately minimal and mirrors date-fns naming conventions, so formatInTimeZone reads like a natural extension of format. For most applications a single function call is enough, options objects are optional, and an fp build offers curried variants for functional pipelines. The README documents each function with signatures and runnable examples, keeping the learning curve low for anyone already using date-fns.

Used by 27 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,588

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
74
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated yesterday
TypeScript
96%
Other

Cal.diy

Scheduling

48,218

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
95
Repo Health
86
Technical
65
Dependency
Built with
TypeScript96%
Updated yesterday
Ruby
49%
Other

Chatwoot

Customer Support

36,549

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
69
Dependency
Built with
Ruby49%
Vue26%
JavaScript22%
Updated yesterday
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,640

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
69
Repo Health
76
Technical
62
Dependency
Built with
JavaScript90%
Updated 1 weeks ago
TypeScript
81%
Other

Directus

CMS · Low Code Platforms

37,783

Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.

View details
92
Repo Health
82
Technical
76
Dependency
Built with
TypeScript81%
Vue18%
Updated 3 days ago
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,926

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
62
Dependency
Built with
TypeScript92%
Updated 5 months ago
TypeScript
97%
Other

GrowthBook

Developer Tools · Analytics · Monitoring

8,299

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
63
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
99%
MIT

GraphQL Hive

Developer Tools · Devops · Monitoring

484

Open-source GraphQL schema registry and observability platform with breaking change detection, federation support, and CI/CD integration for teams of any size.

View details
89
Repo Health
81
Technical
69
Dependency
Built with
TypeScript99%
Updated 2 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,586

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
89
Repo Health
86
Technical
62
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search