[CSHARP-3522] C# driver assumes the DateTime is of kind Local when it's Unspecified Created: 01/Apr/21 Updated: 06/Apr/21 Resolved: 06/Apr/21 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.10.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Diana Zhivkova | Assignee: | Robert Stam |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
|
| Comments |
| Comment by Robert Stam [ 06/Apr/21 ] |
|
I understand that it might be logical to assume DateTime values of Kind Unspecified are in UTC. The server requires that all DateTime values be in UTC, so we call `date.ToUniversalTime()` to ensure that. The behavior of `dateTime.ToUniversalTime()` is:
So we are simply relying on the standard behavior of the DateTime ToUniversal method here. At this point changing the behavior would be a breaking change, so the reasonable course of action here is to leave the current behavior in place.
|