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
17 changes: 17 additions & 0 deletions src/NJsonSchema.Tests/Validation/FormatDateTimeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,22 @@ public void When_format_date_time_with_iso8601_and_fractional_seconds_then_valid
// Assert
Assert.Empty(errors);
}

[Fact]
public void When_format_date_time_with_utc_date_only_then_validation_succeeds()
{
// Arrange
var schema = new JsonSchema();
schema.Type = JsonObjectType.String;
schema.Format = JsonFormatStrings.DateTime;

var token = new JValue("2024-01-31Z");

// Act
var errors = schema.Validate(token);

// Assert
Assert.Empty(errors);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DateTimeFormatValidator : IFormatValidator
"yyyy-MM-dd'T'HH",
"yyyy-MM-dd' 'HH",
"yyyy-MM-dd",
"yyyy-MM-dd",
"yyyy-MM-dd'Z'",
"yyyyMMdd",
"yyyy-MM",
"yyyy"
Expand Down
Loading