OpenAPITools / OpenAPITools/openapi-generator
[REQ] [Dart2] Allow specifying Locale or DateFormat
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
currently, the api.dart file generates the dateformatter as : final _dateFormatter = DateFormat('yyyy-MM-dd');
This is causing an issue in my app as I need to specify a fixed locale value for the DateFormat() constructor.
This is because the _dateFormatter formats dates according to the current app locale,
which can generate some unicode string dates which the server & the integrations do not accept;
They only accept english formatted dates.
Describe the solution you'd like
the ability to pass the locale to the constructor.
Describe alternatives you've considered
the ability to change the value of _dateFormatter (being var).
this seems to have been a point of discussion earlier, at https://github.com/OpenAPITools/openapi-generator/pull/6389#discussion_r467464348
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Dart2-generated api.dart and trace where _dateFormatter is created and used. Confirm how DateFormat currently receives locale information, then define a way for generated clients to use a fixed locale or configurable formatter; done means generated dates no longer depend unexpectedly on the app locale while existing formatting remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100