-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
47:44.92714 T:EventRepository - PUT http://localhost:9200/test-events-201609/events/57ce0700f8a10338d0e43fef
{
"id": "57ce0700f8a10338d0e43fef",
"is_first_occurrence": false,
"is_fixed": false,
"is_hidden": false,
"created_utc": "2016-09-06T21:47:44.420841Z",
"date": "2016-09-05T19:00:00-05:00"
}
47:45.05973 T:EventRepository - GET http://localhost:9200/test-events-201609/events/57ce0700f8a10338d0e43fef
var ev = await _repository.AddAsync(new PersistentEvent { CreatedUtc = DateTime.UtcNow, Date = new DateTimeOffset(DateTime.UtcNow.Date, TimeSpan.Zero)});
var result = await _repository.GetByIdAsync(ev.Id);
Assert.Equal(ev.CreatedUtc, result.CreatedUtc);
Assert.Equal(ev.Date, result.Date);As you can see from the screenshot and code above...
- The DateTime CreatedUtc property will lose the timezone info when deserialized from the server (this changes the DateTime.Kind property which is a big issue).
- The DateTimeOffset Date property loses offset information during serialization (when being sent to the server).
The asserts pass because the tick count is the same but if you implement GetHashCode or assert the Kind and Offset properties it will fail.
Metadata
Metadata
Assignees
Labels
No labels
