Skip to content

Commit

Permalink
Fixed bug in DateTime renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjoern Stiel committed Oct 27, 2016
1 parent f2e6c75 commit ee7a378
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Requests.sln
Expand Up @@ -12,10 +12,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
appveyor.yml = appveyor.yml
docs\Examples.xlsb = docs\Examples.xlsb
docs\get.rst = docs\get.rst
docs\index.rst = docs\index.rst
docs\install.ps1 = docs\install.ps1
docs\installation.rst = docs\installation.rst
LICENSE.txt = LICENSE.txt
docs\post.rst = docs\post.rst
docs\quickstart.rst = docs\quickstart.rst
README.rst = README.rst
EndProjectSection
Expand Down
3 changes: 3 additions & 0 deletions Requests/ExcelRenderer.cs
Expand Up @@ -25,6 +25,9 @@ public static object Render(JToken token, string path, bool traverse)
if (token.Type == JTokenType.Boolean)
return token.ToObject<bool>();

if (token.Type == JTokenType.Date)
return token.ToObject<DateTime>();

if (token.Type == JTokenType.Array)
{
if (!traverse)
Expand Down
7 changes: 7 additions & 0 deletions RequestsTest/RendererTest.cs
Expand Up @@ -39,5 +39,12 @@ public void Can_Render_Simple_Array_of_Arrays()
}


[Test]
public void Can_Render_DateTime()
{
var token = Parser.Parse(@"{""created_at"": ""2016-09-13T20:40:41Z""}");
var result = ExcelRenderer.Render(token["created_at"], "http://api.test.com/numbers", true);
Assert.AreEqual(new DateTime(2016, 9, 13, 20, 40, 41), result);
}
}
}
2 changes: 1 addition & 1 deletion appveyor.yml
@@ -1,4 +1,4 @@
version: 0.1.{build}
version: 0.2.{build}
skip_tags: true
skip_commits:
message: /\[skip ci\]/
Expand Down

0 comments on commit ee7a378

Please sign in to comment.