[BUG][dart-dio] optimize parameterToString to convert DateTime correctly
See original GitHub issueDescription
Currently DateTime is being converted to string using normal .ToString() Ref: https://github.com/OpenAPITools/openapi-generator/blob/c3220848f24bbc5e5441f53846916eaa82e6673c/modules/openapi-generator/src/main/resources/dart-dio/api_util.mustache#L6-L14
instead, toIso8601String
should be used
openapi-generator version
V5.0.0
Suggested fix:
if (value == null) {
return '';
} else if (value is String || value is num) {
return value.toString();
} else if (value is DateTime) {
return value.toIso8601String();
} else {
return json.encode(serializers.serialize(value));
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Custom date and time format strings | Microsoft Learn
Learn to use custom date and time format strings to convert DateTime or DateTimeOffset values into text representations, or to parse strings ...
Read more >Where's the DateTime 'Z' format specifier? - Stack Overflow
A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling...
Read more >Demystifying DateTime Manipulation in JavaScript - Toptal
Use the toISOString() or toJSON() methods of the Date object to convert the local DateTime to UTC. const dateFromUI = "12-13-2012"; const timeFromUI...
Read more >Changelog — Python 3.11.1 documentation
gh-99891: Fix a bug in the tokenizer that could cause infinite recursion when showing ... bpo-43464: Optimize set.intersection() for non-set arguments.
Read more >MATLAB datestr - MathWorks
datestr is not recommended. To convert datetime values to text, use the string or char function instead. For more information on updating your...
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 FreeTop 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
Top GitHub Comments
Both should now work with collections and
path[]=value1&path[]=value2
format. We can not configure the collection format forapplication/x-www-form-urlencoded
until https://github.com/flutterchina/dio/pull/808 is released.The
application/x-www-form-urlencoded
part should now be handled correctly by #9635