Skip to content
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

DateTime should support both point and comma characters for parsing a ISO8601 string #35576

Closed
gokkep opened this issue Jan 6, 2019 · 3 comments
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

Comments

@gokkep
Copy link

gokkep commented Jan 6, 2019

  • Dart SDK Version
    Dart 2.1.0 used through Visual Studio code (v1.30) and Flutter 0.11.9
  • Whether you are using Windows, MacOSX, or Linux
    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.

@lrhn lrhn added 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 labels Jan 7, 2019
@vasilescur
Copy link
Contributor

@kevmoo
Copy link
Member

kevmoo commented Jan 10, 2019

cc @lrhn

@vasilescur
Copy link
Contributor

Fixed in edb68da and merged.

@kevmoo kevmoo closed this as completed Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants