Skip to content

Commit

Permalink
trying to fix CI error with returning current OffsetDateTime in conve…
Browse files Browse the repository at this point in the history
…rter method when offset is empty
  • Loading branch information
Tomáš Pozler committed Oct 17, 2023
1 parent 06fc180 commit 2d03578
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ public static Currency[] ToCurrencyArray(GrpcCurrencyArray arrayValue)

public static DateTimeOffset ToDateTimeOffset(GrpcOffsetDateTime offsetDateTimeValue)
{
if (string.IsNullOrEmpty(offsetDateTimeValue.Offset))
{
return DateTimeOffset.Now;
}
TimeSpan hourOffset = TimeSpan.FromHours(int.Parse(offsetDateTimeValue.Offset.Substring(1, 2)));
bool add = offsetDateTimeValue.Offset.ElementAt(0) == '+';
TimeSpan offset = add ? hourOffset : hourOffset.Negate();
Expand Down

0 comments on commit 2d03578

Please sign in to comment.