Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private static string ConvertStringValue(string fieldName, IReadOnlyDictionary<s
// https://github.com/Azure/azure-sdk-for-net/issues/10361
dateTimeOffsetValue = value.Type switch
{
FieldValueType.DateType => value.ValueDate == null ? default : DateTimeOffset.Parse(value.ValueDate, CultureInfo.InvariantCulture),
FieldValueType.DateType => value.ValueDate.HasValue ? value.ValueDate.Value : default,
FieldValueType.TimeType => value.ValueTime == null ? default : DateTimeOffset.Parse(value.ValueTime, CultureInfo.InvariantCulture),
_ => throw new InvalidOperationException($"The value type {value.Type} was expected to be a Date or Time")
};
Expand Down
7 changes: 3 additions & 4 deletions sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public float AsFloat()
}

/// <summary>
/// Gets the value of the field as a <see cref="DateTimeOffset"/>.
/// Gets the value of the field as a <see cref="DateTime"/>.
/// </summary>
/// <returns></returns>
public DateTime AsDate()
Expand All @@ -93,13 +93,12 @@ public DateTime AsDate()
throw new InvalidOperationException($"Cannot get field as Date. Field value's type is {Type}.");
}

DateTime date = default;
if (!DateTime.TryParse(_fieldValue.ValueDate, out date))
if (!_fieldValue.ValueDate.HasValue)
{
throw new InvalidOperationException($"Cannot parse Date value {_fieldValue.ValueDate}.");
}

return date;
return _fieldValue.ValueDate.Value.UtcDateTime;
Comment thread
maririos marked this conversation as resolved.
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public virtual async Task<Response> DeleteModelAsync(string modelId, Cancellatio
[ForwardsClientCalls]
public virtual Pageable<CustomFormModelInfo> GetModelInfos(CancellationToken cancellationToken = default)
{
return ServiceClient.GetCustomModelsPageableModelInfo(GetModelOptions.Full, cancellationToken);
return ServiceClient.GetCustomModelsPageableModelInfo(cancellationToken);
}

/// <summary>
Expand All @@ -178,7 +178,7 @@ public virtual Pageable<CustomFormModelInfo> GetModelInfos(CancellationToken can
[ForwardsClientCalls]
public virtual AsyncPageable<CustomFormModelInfo> GetModelInfosAsync(CancellationToken cancellationToken = default)
{
return ServiceClient.GetCustomModelsPageableModelInfoAsync(GetModelOptions.Full, cancellationToken);
return ServiceClient.GetCustomModelsPageableModelInfoAsync(cancellationToken);
Comment thread
maririos marked this conversation as resolved.
}

/// <summary>
Expand All @@ -189,7 +189,7 @@ public virtual AsyncPageable<CustomFormModelInfo> GetModelInfosAsync(Cancellatio
[ForwardsClientCalls]
public virtual Response<AccountProperties> GetAccountProperties(CancellationToken cancellationToken = default)
{
Response<Models_internal> response = ServiceClient.RestClient.GetCustomModels(GetModelOptions.Summary, cancellationToken);
Response<Models_internal> response = ServiceClient.RestClient.GetCustomModels(cancellationToken);
return Response.FromValue(new AccountProperties(response.Value.Summary), response.GetRawResponse());
}

Expand All @@ -201,7 +201,7 @@ public virtual Response<AccountProperties> GetAccountProperties(CancellationToke
[ForwardsClientCalls]
public virtual async Task<Response<AccountProperties>> GetAccountPropertiesAsync(CancellationToken cancellationToken = default)
{
Response<Models_internal> response = await ServiceClient.RestClient.GetCustomModelsAsync(GetModelOptions.Summary, cancellationToken).ConfigureAwait(false);
Response<Models_internal> response = await ServiceClient.RestClient.GetCustomModelsAsync(cancellationToken).ConfigureAwait(false);
return Response.FromValue(new AccountProperties(response.Value.Summary), response.GetRawResponse());
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading