Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8632
Closed
Open
Issue created Feb 07, 2021 by Administrator@rootContributor

[JS] the replace statement in parseDate is too greedy

Created by: tray2100

Description

Currently in the parseDate() function it uses replace('/T/', ' ') to convert date strings into something that the Date class can use for construction. This works well for ISO_8601 date strings but it also has the side effect of ruining date strings that have GMT in it.

openapi-generator version

5.0.0

Suggest a fix/enhancement

Current:

new Date(str.replace(/T/i, ' ')) => Wed Apr 15 2020 00:00:00 GM -0700 (Pacific Daylight Time)

Fix:

new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3')) => Wed Apr 15 2020 00:00:00 GMT-0700 (Pacific Daylight Time)

This allows GMT based date strings to work without issue.

Assignee
Assign to
Time tracking