mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-08 16:36:15 +00:00
Fixed DateTime converter for nanosecond times in string format
This commit is contained in:
parent
2c43ee7554
commit
893d0c723d
@ -19,6 +19,7 @@ namespace CryptoExchange.Net.UnitTests
|
|||||||
[TestCase("1620777600.000")]
|
[TestCase("1620777600.000")]
|
||||||
[TestCase("1620777600000")]
|
[TestCase("1620777600000")]
|
||||||
[TestCase("2021-05-12T00:00:00.000Z")]
|
[TestCase("2021-05-12T00:00:00.000Z")]
|
||||||
|
[TestCase("2021-05-12T00:00:00.000000000Z")]
|
||||||
[TestCase("", true)]
|
[TestCase("", true)]
|
||||||
[TestCase(" ", true)]
|
[TestCase(" ", true)]
|
||||||
public void TestDateTimeConverterString(string input, bool expectNull = false)
|
public void TestDateTimeConverterString(string input, bool expectNull = false)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
@ -110,7 +111,7 @@ namespace CryptoExchange.Net.Converters
|
|||||||
return new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc);
|
return new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonConvert.DeserializeObject(stringValue);
|
return DateTime.Parse(stringValue, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal);
|
||||||
}
|
}
|
||||||
else if(reader.TokenType == JsonToken.Date)
|
else if(reader.TokenType == JsonToken.Date)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user