DateTime should support both point and comma characters for parsing a ISO8601 string #35576
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-core
type-enhancement
A request for a change that isn't a bug
Dart 2.1.0 used through Visual Studio code (v1.30) and Flutter 0.11.9
Using MacOsX
I am trying to convert a date time from a string to a 8601 format into a Dart DateTime instance.
I am using the Eiffel method and language on the server. I am using the ISO8601 library which currently outputs Eiffel DATE_TIME instances to a proper specified ISO 8601 string.
The library is currently always using a ',' (comma) character to separate the decimal fraction.
For example the date time: yyyy-mm-dd hh:mm:ss 2019-01-06 11:39:00
is converted by the library to the string: "2019-01-06T11:39:00,0"
When this is sent (using the JSON format) to a flutter dart application where the string is to be converted to a Dart DateTime object using the parse feature like:
DateTime dateTime = DateTime.parse("2019-01-06T11:39:00**,**0") --> is throwing an exception.
This is correct while it follows the specification of the DateTime implementation in Dart where the decimal fraction may only be a '.' (point) character.
I want to propose that this is changed in the Dart implementation, while following the ISO8601 specification it could be both a point or a comma, where even the comma is preferred!
I think this should be implemented in Dart or else my server implementation is getting the burden to have knowledge about the the client where the date time is generated for. The Dart DateTime should be able to convert both styles.
The text was updated successfully, but these errors were encountered: