Skip to content

[BUG][TYPESCRIPT-RXJS] Format Date is converted to Date-Time #4763

@guidoknoll

Description

@guidoknoll

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

Hey,

when generating a parameter with the format 'date', it is falsely converted to 'date-time'. So in my case 'dateFrom' contains a time (e.g. '2019-12-10T17:56:56.999Z'), but should look like this: '2019-12-10'.

openapi-generator version

4.2.2

OpenAPI declaration file content or url
...
- name: date_from
          in: query
          description: >-
            Date parameter to search for ... (format\: \"yyyy-MM-dd\")
          required: false
          schema:
            type: string
            format: date
...
Command line used for generation

openapi-generator generate -i assets/api.yaml -g typescript-rxjs -o src/lib

Steps to reproduce
  • Generate the api
  • View the dateFrom parameter
Related issues/PRs
Suggest a fix

As in the typescript-fetch generator, write instead of .toISOString():

.toISOString().substr(0,10) or
.toISOString().split('T')[0]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions