Skip to content

Commit

Permalink
Merge pull request #1118 from microsoft/revert-1102-is/fix-date-seria…
Browse files Browse the repository at this point in the history
…lization

Revert "Serialize `OpenApiDate` values properly to short date"
  • Loading branch information
MaggieKimani1 authored Jan 5, 2023
2 parents 04a4880 + 70a5b57 commit c8e107d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Any/OpenApiPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)

case PrimitiveType.Date:
var dateValue = (OpenApiDate)(IOpenApiPrimitive)this;
writer.WriteValue(dateValue.Value.ToShortDateString());
writer.WriteValue(dateValue.Value.ToString("o").Substring(0, 10));
break;

case PrimitiveType.DateTime:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
]
}
],
"aDate": "12/12/2022"
"aDate": "2022-12-12"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}],"aDate":"12/12/2022"}}
{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}],"aDate":"2022-12-12"}}

0 comments on commit c8e107d

Please sign in to comment.