-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REQ] [Qt5][client][server] Use a particular DateTime format during saving model as a JSON string #5708
Comments
@DevASG
I tried this and this does not seem to work. QDateTime::toString does not support these
See here It is lame. I could build a custom solution but not sure if it will be deprecated soon in next Qt version.. EDIT: |
@etherealjoy Currently, after serialization an OpenAPIObject with QDateTime field indise will look like "2020-03-30T08:59:31[Z|[+|-]08:59]". A possible correct ISO::DateTime view is "2020-03-30T08:59:31.474Z" (UTC time format).
|
@DevASG
This one I fixed here already.
This did not work. But I did provide a way to set the string though. |
@etherealjoy |
Is your feature request related to a problem? Please describe.
I'm using c++ Qt5 client and server in a network mediator application.
The app receives JSONs, collects them and resends to the Java server using a schedule.
The Java server is generated with OpenAPI also.
The problem is there is a DateTime format mismatch between Qt5 [client/server] and JAVA.
with
"2017-07-08T22:35:29.771Z" - suffix Z, means UTC time
"2017-07-08T22:35:29+02:30" - time zone
"2017-07-08T22:35:29.771+02:30" - with a suffix and a timezone
" 2017-07-08T22:35:29" - withnout Z and a timezone.
Describe the solution you'd like
Currently, QDateTime transforms into a string using a Qt::ISODate format.
QString toStringValue( const QDateTime& value ) {
// ISO 8601
return value.toString( Qt::ISODate );
}
It would be useful for me to set a particular DateTime format option during code generation.
Example for cpp-qt5-client:
useQDateTimeFormat="yyyy-MM-ddTHH:mm:ss.zzzZ";
Smth like this:
QString const DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.zzzZ";
QString toStringValue( const QDateTime& value ) {
return value.toString( QtDateTimeFormat );
}
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: