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,180 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
44 /100 Fair
Development Activity 0
Maintenance 20
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 85
Code Quality 82
Innovation 84
Learning Curve 80

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 28 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

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

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 1 months ago
TypeScript
96%
Other

Cal.diy

Scheduling

48,697

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

View details
91
Repo Health
86
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
Ruby
50%
Other

Chatwoot

Customer Support

37,254

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
Ruby 50%
Vue 25%
JavaScript 22%
Updated 1 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,650

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

View details
67
Repo Health
76
Technical
62
Dependency
Built with
JavaScript 90%
Updated 1 months ago
TypeScript
79%
Other

Directus

CMS · Low Code Platforms

37,987

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
TypeScript 79%
Vue 19%
Updated 2 weeks ago
TypeScript
92%
MIT

Dittofeed

Automation · Marketing

2,968

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
TypeScript 92%
Updated 6 months ago
TypeScript
97%
Other

GrowthBook

Ab Testing Experimentation · Analytics · Developer Tools

8,446

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
TypeScript 97%
Updated 1 weeks ago
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
90
Repo Health
81
Technical
69
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago
TypeScript
61%
EPL-2.0

Huly Platform

Collaboration · Project Management · Team Chat

27,797

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
62
Dependency
Built with
TypeScript 61%
Svelte 34%
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