-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DateTime.Now usage analyzer #9
Comments
It should first prefer to change it to |
Fields, parameters, and local variables of type |
I think it is possible to suggest more than one code action for a diagnostic. So, the simpliest one would be to replace it with DateTime.UtcNow which would be trivial. Later, it can have the |
I love the idea of this analyzer. I've been advocating against In client-side code (desktop, phone, store apps, etc), However, on the server, the local time zone is almost never appropriate. Server applications should either work strictly with UTC, or use I'm not sure exactly how suggested replacements should be implemented. It's great that something would warn you about the problems of using local time. However, when you get in to automatic refactoring, swapping in |
DateTime.Now
is 99.9% of time is evil. Hmm, let's make it 100% 😄The analyzer should analyze
DateTime.Now
usage and give warnings for usages. It should also suggest replace it withDateTime.UtcNow
.The text was updated successfully, but these errors were encountered: