Skip to content

Update date-fns to v4, migrate date-fns-tz to @date-fns/tz, use subpath imports#686

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-date-fns-dependencies
Draft

Update date-fns to v4, migrate date-fns-tz to @date-fns/tz, use subpath imports#686
Copilot wants to merge 2 commits intomainfrom
copilot/update-date-fns-dependencies

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

Aligns date-fns usage with sanity-io/sanity: upgrade to v4, drop date-fns-tz for @date-fns/tz, and use subpath imports throughout.

@sanity/assist

  • date-fns ^3.6.0^4.1.0
  • Barrel imports → subpath imports

@sanity/rich-date-input

  • date-fns ^2.30.0^4.1.0
  • date-fns-tz removed, @date-fns/tz ^1.4.1 added
  • formatInTimeZone(date, tz, fmt)format(date, fmt, {in: tz(timezone)})
  • getTimezoneOffset(tz, date) / 60 / 1000-new TZDate(date, tz).getTimezoneOffset()
  • zonedTimeToUtc → helper using TZDate constructor (same pattern as sanity core's createTZDateFromComponents)

Lint

  • Added date-fns barrel import restriction to .oxlintrc.json
-import {formatDistanceToNow} from 'date-fns'
+import {formatDistanceToNow} from 'date-fns/formatDistanceToNow'

-import {formatInTimeZone, getTimezoneOffset, zonedTimeToUtc} from 'date-fns-tz'
+import {tz, TZDate} from '@date-fns/tz'
+import {format} from 'date-fns/format'

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sanity-cdn.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/plugins/plugins/dev/test-studio/node_modules/.bin/../sanity/bin/sanity build git conf�� -report-unused-disable-directives --global bin/node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Update all date-fns dependencies in the same way we did it on https://github.com/sanity-io/sanity which is where most of our date-fns code in this repo is originally from


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2026

🦋 Changeset detected

Latest commit: 4d7d9c1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sanity/assist Patch
@sanity/rich-date-input Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview, Comment Mar 6, 2026 2:09pm

Request Review

…date-fns/tz, use subpath imports

Co-authored-by: stipsan <81981+stipsan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update all date-fns dependencies Update date-fns to v4, migrate date-fns-tz to @date-fns/tz, use subpath imports Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants