swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Format:date with example renders time in addition to date

Open ilya-spv opened this issue 6 years ago • 3 comments

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Chrome
  • Version: 72
  • Method of installation: visual studio code extension (openapi-designer)
  • Swagger-UI version: [e.g. 3.21.0]
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

I use a visual studio extension to render things on the fly (openapi-designer) and have checked that it uses the latest version of swagger-ui

Example Swagger/OpenAPI definition:

startDate:
   type: string
   format: date
   example: 2018-12-25

Describe the bug you're encountering

There was recently a pull request to make automatic example if it is not present. That works fine, but when I have my own example, then the rendered date for some reason includes timestamp as well:

"startDate": "2018-12-25T00:00:00.000Z",

To reproduce...

  1. Render YAML with type: string and format: date
  2. Open an example value in the browser

Expected behavior

Expected to see only date in example

"startDate": "2018-12-25",

ilya-spv avatar Mar 04 '19 14:03 ilya-spv

Indeed, the specification is pretty clear on this.

shockey avatar Mar 06 '19 02:03 shockey

@shockey Pretty clear on what the issue is. Could i try to solve this bug? Would appreciate if i could be assigned the issue.

parthpetkar avatar Oct 11 '25 04:10 parthpetkar

hey @parthpetkar 👋 are you able to reproduce the issue? I've tried it with the following example and bug seems to be fixed already

Image

robert-hebel-sb avatar Oct 30 '25 17:10 robert-hebel-sb