chore(deps): upgrade date-fns from v2 to v3#3370
Conversation
Bumps date-fns to ^3.6.0 in @vibe/core and the docs workspace. date-fns v3 is ESM-first and ships smaller, more tree-shakable builds. Existing usage (named imports of format/isAfter/isBefore/isSameDay, the Locale type, and the date-fns/locale subpath) is fully compatible with v3, so no source changes are required. react-day-picker@8.10.1 already declares "date-fns": "^2.28.0 || ^3.0.0", so no peer-dependency conflict. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Code Review by Qodo
1. Duplicate date-fns versions
|
date-fns v3 no longer exposes Locale as a global type. Import it explicitly so TypeScript can resolve the type in DatePicker props. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Persistent review updated to latest commit b928dd4 |
|
📦 Bundle Size Analysis ✅ No bundle size changes detected. Unchanged Components
📊 Summary:
|
rivka-ungar
left a comment
There was a problem hiding this comment.
According to claude:
Not 100% safe. The runtime behavior is fine — all used functions (format, isAfter, isBefore, isSameDay) and locale imports are fully compatible with v3.
However, there's a type-level breaking change for consumers who have their own date-fns@^2 installed and pass a locale to : v3's
Locale interface makes properties required that v2 declared optional, so TypeScript will error on the mismatch since date-fns is externalized and Locale is exposed in DatePickerProps.
wdyt?
|
@rivka-ungar but isn't this something that is "by-luck" are we defining somewhere that the Locale should be compatible with dns-2.0 ? |
User description
Summary
date-fnsfrom^2.30.0to^3.6.0in@vibe/coreand the docs workspace.Why
date-fns v3 is ESM-first and ships smaller, more tree-shakable builds. v2 has been on maintenance mode since late 2023.
Compatibility checks
Named imports (
format,isAfter,isBefore,isSameDay) — unchanged in v3.Type imports (
type Locale) —Localeis still re-exported from the main entry viaexport type * from "./locale/types.js"indate-fns/types.d.ts.Subpath imports (
import { ja } from "date-fns/locale") — still valid in v3.Peer dependency check —
react-day-picker@8.10.1(currently used by core) declares"date-fns": "^2.28.0 || ^3.0.0", so no peer conflict.Touched files
packages/core/package.jsonpackages/docs/package.jsonyarn.lock(no .ts/.tsx changes; verified the 5 existing import sites continue to type-check against v3 declarations)
Test plan
jalocale + format strings@vibe/corestays the same or drops (date-fns v3 is more tree-shakable)🤖 Generated with Claude Code
PR Type
Enhancement
Description
Upgrade date-fns from v2 to v3 across core and docs packages
Add explicit Locale type import in DatePicker component
Leverage ESM-first v3 for smaller, tree-shakable builds
Maintain full compatibility with existing date-fns usage patterns
Diagram Walkthrough
File Walkthrough
package.json
Update date-fns to v3 in core packagepackages/core/package.json
package.json
Update date-fns to v3 in docs packagepackages/docs/package.json
DatePicker.types.ts
Import Locale type explicitly for v3 compatibilitypackages/core/src/components/DatePicker/DatePicker.types.ts
longer globally exposed