Find DateTime.Now/UtcNow usage (TimeProvider in .NET 8)
Recipe ID
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindTimeAbstractionArtifactOpenRewrite.Recipes.CSharp.Migration.DotnetFinds usages of DateTime.Now, DateTime.UtcNow, DateTimeOffset.Now, and DateTimeOffset.UtcNow. In .NET 8+, TimeProvider is the recommended abstraction for time.
Single recipemodernizationsearchdotnetnet8Proprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindTimeAbstractionIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet