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
  • #9279
Closed
Open
Issue created Apr 16, 2021 by Administrator@rootContributor

[REQ] [Qt5] [C++] Allow for dateTime format to be ISODateWithMs (not just ISODate)

Created by: xconverge

Is your feature request related to a problem? Please describe.

I would like to use ISODateWithMs and right now the only way to do that is to call:

SerializerSettings
bool setDateTimeFormat(const QString& dateTimeFormat);

and hope that you can supply a QString that meets your needs.

Here is the current code for serializing datetimes

QString toStringValue(const QDateTime &value) {
    // ISO 8601
    return SerializerSettings::getInstance()->getDateTimeFormat().isEmpty()? value.toString(Qt::ISODate):value.toString(SerializerSettings::getInstance()->getDateTimeFormat());
}

Describe the solution you'd like

I would like to also have the option of setting Qt::ISODateWithMs to the serializer. trying to do it manually with the string is difficult due to timezones.

I can do a few things:

  1. add a boolean to SerializerSettings called useMsInDateTime, which then switches between Qt::ISODate and Qt::ISODateWithMs
  2. add a setter for setDateTimeFormat overloaded to accept a Qt::DateFormat and then adjust the logic in toStringValue to also look for if this was set and use it if so.

Describe alternatives you've considered

"yyyy-MM-ddTHH:mm:ss.zzzZ" "yyyy-MM-ddTHH:mm:ss.zzz[Z|[+|-]HH:mm]" etc all have issues with timezones when passed in as just a string format. So the ability to pass the enum as well would fix this

Assignee
Assign to
Time tracking