[BUG][TYPESCRIPT-RXJS] Format Date is converted to Date-Time
See original GitHub issueBug 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]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
How can I convert string to datetime with format specification ...
Use new Date(dateString ) if your string is compatible with Date.parse() . If your format is incompatible (I think it is), you have...
Read more >Convert dates stored as text to dates - Microsoft Support
Convert text dates with two-digit years by using Error Checking · Select the cell, cell range, or column that you want to reformat....
Read more >Convert string or numeric time values into date format ...
Use this tool to specify a standard or custom time format for interpreting date and time values and converting those into a date...
Read more >pandas.to_datetime — pandas 1.5.2 documentation
Convert argument to datetime. This function converts a scalar, array-like, Series or DataFrame /dict-like to a pandas datetime object. ... Specify a date...
Read more >Convert Text and Numbers to Date and Date & Time
See the examples below, replacing field with the name of the original (unrecognized) field. Example formulas. If field is a text field… Format....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@guidoknoll you can take the package from my forks, there this and some other problems are fixed https://github.com/Xambey/openapi-generator-cli and https://github.com/Xambey/openapi-generator openapi-generator-cli.zip
as a starting point: adjust the template in https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache then run
mvn clean package
and re-generate the samples by running https://github.com/OpenAPITools/openapi-generator/blob/master/bin/typescript-rxjs-petstore-all.shfinally commit the changed templates and the generated samples.