Skip to content
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

Timezone conversions #380

Merged
merged 8 commits into from
May 11, 2023
Merged

Timezone conversions #380

merged 8 commits into from
May 11, 2023

Conversation

Bram1903
Copy link
Collaborator

@Bram1903 Bram1903 commented May 5, 2023

I will write the PR documentation later, as this is still a draft. I still need to go through the whole project for actually making sure that all the times are in UTC, but this PR allows us to both work on this PR.

Added: SimplerSoftware.EntityFrameworkCore.SqlServer.NodaTime
Added: Enabled the .UseNodaTime option in the DbContextOptionsBuilder
Working on ToLocal on the Logs.razor
@Bram1903 Bram1903 added Enhancement New feature or request Help Wanted Extra attention is needed labels May 5, 2023
@Bram1903 Bram1903 linked an issue May 5, 2023 that may be closed by this pull request
@Bram1903 Bram1903 marked this pull request as ready for review May 5, 2023 13:08
@Bram1903 Bram1903 marked this pull request as draft May 5, 2023 13:08
@neozhu
Copy link
Owner

neozhu commented May 5, 2023

@Bram1903
see this:https://learn.microsoft.com/en-us/dotnet/api/system.datetime.touniversaltime?view=net-7.0
DateTime object has standard method
The ToUniversalTime() method is sometimes used to convert a local time to UTC. The ToLocalTime() method is then called to restore the original local time.

@Bram1903
Copy link
Collaborator Author

Bram1903 commented May 5, 2023

Technically we don't have to convert it back to local time in order for the library to convert it to the users timezone based on their browser information. As long as the library knows it's dealing with UTC it's fine, isn't it? The only reason it didn't work at first was because the library didn't know it was dealing with an UTC DateTime, which is why I specified that the given DateTime was of the kind UTC.

@neozhu
Copy link
Owner

neozhu commented May 11, 2023

@Bram1903
I think I can merge this PR into the main branch, right?

@Bram1903
Copy link
Collaborator Author

Bram1903 commented May 11, 2023

@Bram1903
I think I can merge this PR into the main branch, right?

I'm not certain if we finished moving everything from .now to .UtcNow. I haven't yet had the time to go over everything, but it shouldn't be an issue to merge it into main. I'm planning on taking another look later this week.

@Bram1903 Bram1903 marked this pull request as ready for review May 11, 2023 11:58
@Bram1903 Bram1903 requested a review from neozhu May 11, 2023 11:58
@Bram1903 Bram1903 changed the title Timezone conversions (DRAFT: DO NOT MERGE) Timezone conversions May 11, 2023
Copy link
Owner

@neozhu neozhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@neozhu neozhu merged commit 40d7d2e into neozhu:main May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Help Wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timezone Conversions
2 participants