Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws an exception if the datetime cannot be converted. #16288

Merged
merged 15 commits into from
Aug 15, 2024

Conversation

hyzx86
Copy link
Contributor

@hyzx86 hyzx86 commented Jun 11, 2024

Throws an exception if the datetime cannot be converted.

Patch for PR #16205
/cc @hishamco

@@ -40,15 +49,26 @@ public void JsonNode_WhenParseCalled_ConvertShortTimeFormatToTimeField()
var dateField = jobject.SelectNode("DateFieldTest").ToObject<DateField>();
var dateTimeField = jobject.SelectNode("DateTimeFieldTest").ToObject<DateTimeField>();
var timezoneDateTimeFieldTest = jobject.SelectNode("TimezoneDateTimeFieldTest").ToObject<DateTimeField>();
var nullDateTimeField = jobject.SelectNode("NullDateTimeFieldTest").ToObject<DateTimeField>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create another test instead

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@gvkries
Copy link
Contributor

gvkries commented Aug 15, 2024

Why did you change the exception to a NotSupportedException?
The docs states:

When the JSON payload contains tokens that are not valid for the type being deserialized, throw a JsonException.

@sebastienros sebastienros merged commit 59437f1 into OrchardCMS:main Aug 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants