Ripping legacy Moment.js out of a large frontend all at once is nearly impossible. The package adds ~110 KB of raw code, yet swapping it straight to date-fns or Intl.DateTimeFormat breaks locales: Spanish loses dots in month abbreviations, Polish shifts noun cases. Your refactor quickly stalls in reviews with designers and translators.
Medhat Dawoud's team took another route and removed ~1,000 calls across ~500 files in 10 weeks with zero incidents. First, engineers routed every call into a single facade package that still used Moment.js inside. Output didn't change by a single byte, so 40 product teams kept their backlogs untouched. Before the first PR, they put up a lint fence with a shrinking allowlist and ran a codemod that handled ~90% of the edits.
Next, they moved formatting, parsing, and 8 locales inside the facade and verified everything byte-for-byte with golden tests across ~10,000 cases in 6 time zones. Later, they removed even the temporary date-fns dependency in one day, leaving zero date libraries behind. A couple of hiccups popped up: the linter missed four toLocaleString() calls, and a pre-tree-shaking report showed 180 KB instead of the actual 2 KB. Best of all, migrating to the Temporal API later will touch one package instead of five hundred files.
