Migrate Moment.js to Temporal API

Proprietary

Replaces common Moment.js patterns with equivalent native Temporal API usage.

org.openrewrite.javascript.migrate.moment.moment-to-temporal

Optional

Import Temporal from @js-temporal/polyfill in each file the recipe converts, and declare the polyfill in the package.json governing it. Turn this off for a runtime and TypeScript lib that provide Temporal themselves. Default is true.

Also convert moment(text) where the text is not a literal, assuming it is an ISO 8601 date or date-time, with or without an offset. Such text is parsed by a function the recipe adds to the file. Text in any other format, which moment would still read, makes Temporal throw. Default is false.

mod run . --recipe=org.openrewrite.javascript.migrate.moment.moment-to-temporal

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.