Skip to content

Commit

Permalink
Merge branch 'release/0.42.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Apr 27, 2022
2 parents dd98c4f + fed3a49 commit f458ccc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 2 additions & 4 deletions Source/ZoomNet/Json/DateTimeConverter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Globalization;
using System.Text.Json;

namespace ZoomNet.Json
Expand All @@ -15,10 +14,9 @@ public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, Jso
switch (reader.TokenType)
{
case JsonTokenType.String:
var stringValue = reader.GetString();
return DateTime.Parse(stringValue, null, DateTimeStyles.AdjustToUniversal);
return reader.GetDateTime();
default:
throw new Exception("Unable to convert to DateTime");
throw new Exception($"Unable to convert {reader.TokenType.ToEnumString()} to DateTime");
}
}

Expand Down
8 changes: 3 additions & 5 deletions Source/ZoomNet/Json/NullableDateTimeConverter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Globalization;
using System.Text.Json;

namespace ZoomNet.Json
Expand All @@ -16,13 +15,12 @@ internal class NullableDateTimeConverter : ZoomNetJsonConverter<DateTime?>
{
case JsonTokenType.None:
case JsonTokenType.Null:
case JsonTokenType.String when string.IsNullOrEmpty(reader.GetString()):
return null;
case JsonTokenType.String:
var stringValue = reader.GetString();
if (string.IsNullOrEmpty(stringValue)) return null;
return DateTime.Parse(stringValue, null, DateTimeStyles.AdjustToUniversal);
return reader.GetDateTime();
default:
throw new Exception("Unable to convert to nullable DateTime");
throw new Exception($"Unable to convert {reader.TokenType.ToEnumString()} to nullable DateTime");
}
}

Expand Down
4 changes: 2 additions & 2 deletions Source/ZoomNet/ZoomNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@

<ItemGroup>
<PackageReference Include="HttpMultipartParser" Version="5.1.0" />
<PackageReference Include="jose-jwt" Version="3.2.0" />
<PackageReference Include="jose-jwt" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Pathoschild.Http.FluentClient" Version="4.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="System.Text.Json" Version="6.0.2" />
<PackageReference Include="System.Text.Json" Version="6.0.3" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

Expand Down

0 comments on commit f458ccc

Please sign in to comment.