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,180stars
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,526

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

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

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

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
Ruby
49%
Other

Chatwoot

Customer Support

35,974

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
72
Dependency
Built with
Ruby49%
Vue26%
JavaScript22%
Updated today
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,633

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

View details
65
Repo Health
76
Technical
63
Dependency
Built with
JavaScript90%
Updated 1 months ago
TypeScript
80%
Other

Directus

CMS · Low Code Platforms

37,462

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
93
Repo Health
82
Technical
78
Dependency
Built with
TypeScript80%
Vue18%
Updated yesterday
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

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
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
TypeScript
97%
Other

GrowthBook

Developer Tools · Analytics · Monitoring

8,138

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
66
Dependency
Built with
TypeScript97%
Updated today
TypeScript
98%
MIT

GraphQL Hive

Developer Tools · Devops · Monitoring

485

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
90
Repo Health
81
Technical
70
Dependency
Built with
TypeScript98%
Updated today
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,384

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

View details
90
Repo Health
86
Technical
64
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