Skip to content

Commit

Permalink
#69 Fix SendGridDateTimeConverter to return dates in UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Nov 14, 2016
1 parent 7727bc6 commit 7ae4bc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/StrongGrid.UnitTests/Resources/TemplatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void Parse_TemplateVersion_json()
Assert.AreEqual("example_version_name", result.Name);
Assert.AreEqual("ddb96bbc-9b92-425e-8979-99464621b543", result.TemplateId);
Assert.AreEqual("<%body%>", result.TextContent);
Assert.AreEqual(new DateTime(2014, 3, 19, 13, 56, 33, DateTimeKind.Utc), result.UpdatedOn);
Assert.AreEqual(new DateTime(2014, 3, 19, 18, 56, 33, DateTimeKind.Utc), result.UpdatedOn);
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion Source/StrongGrid/Utilities/SendGridDateTimeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.Value == null) return null;
var date = DateTime.ParseExact(reader.Value.ToString(), SENDGRID_DATETIME_FORMAT, new CultureInfo("en-US"), DateTimeStyles.AssumeUniversal);
var date = DateTime.ParseExact(reader.Value.ToString(), SENDGRID_DATETIME_FORMAT, new CultureInfo("en-US"), DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
return date;
}
}
Expand Down

0 comments on commit 7ae4bc9

Please sign in to comment.