The ticket is “show the due date in the user’s locale.” The repo already has date-fns and a formatDate() helper. The agent adds dayjs because that is what its last tutorial used, plus a one-line dayjs(value).format(...) in the component. The bundle grows. The team now has two opinions about time zones.

I’ve started treating a new date (or money, or UUID) library in an agent PR as a dependency review, not a typo. One helper call is not a reason to add a second ecosystem.

Why this happens so often

Date formatting is a solved problem in every training set, and it is solved differently in each one. dayjs, luxon, moment, date-fns, and Temporal all look equally “standard” to a model. It cannot see your bundle budget unless you say so. It also cannot see that formatDate already wraps locale and time zone.

The second library usually arrives without typings consistency, without the same locale loading strategy, and without DST tests. Six months later, someone formats a due date with one library and a created-at with the other, and they disagree around midnight.

A simple date policy

  • One date stack per app — the library and helper already in package.json / src/lib/date.ts
  • No new date dependency for a single format call
  • New formats are added to the helper, not inlined in the component
  • If you truly need a new library, it is its own PR, with a migration note, not a drive-by in a UI ticket

The same rule applies to money, UUID, and HTTP clients. The date case is just the one I see most in UI diffs.

What to put in the prompt

Use the existing date helper in src/lib/date.ts (date-fns). Do not add dayjs, luxon, moment, or a second date package. If a new format is required, add a named function to the helper and use it. Do not inline format strings in the component. 

Paste the helper and a line from package.json that shows the chosen library. In review, grep the diff for new packages and for dayjs / luxon / moment imports.

Relative time (“3 hours ago”) is a frequent excuse for a new dependency. If the app already formats relative time in the helper, use it. If it does not, add formatRelative next to formatDate, with the same locale and clock source, instead of pulling in a package for one function.

Also watch for hidden date libraries inside UI kits the agent adds in the same PR. A “lightweight date picker” can drag moment in through a sidebar. If you need a picker, prefer the one the design system already wraps, or isolate the dependency and say so.

Reject / send back

Reject

  • A new date library added to format one string
  • A component-local new Date().toLocaleDateString() next to a locale-aware helper, if that helper is the standard
  • Two libraries formatting related timestamps in the same PR
  • “It’s only used in this file” as the justification for a new dependency

Accept

  • A new helper function in the existing date module
  • A justified, standalone dependency PR with a removal plan for the old library
  • Temporal only if that is already the team’s chosen path, or the subject of the PR