CleanArchitecture
CleanArchitecture copied to clipboard
Replaced DateTimeService with System.TimeProvider
Starting from .NET 8 there is an inbuild TimeProvider Class which can be used as an abstractrion over DateTime. https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider?view=net-8.0
I think it's better to save in UTC time, and convert to local time for display when outputting.
I think it's better to save in UTC time, and convert to local time for display when outputting.
I agree. I was also thinking about changing Created and LastModified to DateTimeOffset and saving it to UTC time.
@jasontaylordev what do you think?
I think it's better to save in UTC time, and convert to local time for display when outputting.
I agree. I was also thinking about changing Created and LastModified to DateTimeOffset and saving it to UTC time.
@jasontaylordev what do you think?
I agree, thanks for the contribution. 🙂
Thanks again @tonven. Once the final changes come through, I'll review and merge.
If you change to using UTC, I suggest to also reflect that to the property names CreatedUTC
and LastModifiedUTC
What these values need to contain so depend on the usecase. If these properties are for 'operational' reasons, UTC is the best value, as you can correlate typically with server logs which also (should) have UTC. If these values are to be used to define when the user created/modified the TodoItem, a full DateTimeOffset
should be used, unless you are sure to always be operating in a single timezone.
Closing due to inactivity, feel free to raise again.