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

Parsing datetimes that are just digits with no delimiters fails #354

Closed
alan-knight opened this issue Feb 11, 2015 · 3 comments
Closed

Parsing datetimes that are just digits with no delimiters fails #354

alan-knight opened this issue Feb 11, 2015 · 3 comments
Assignees

Comments

@alan-knight
Copy link
Contributor

For example, '20150210195856'. The parsing logic just tries to find the next digits without regard to the length, so it pulls in too much data.

@alan-knight alan-knight self-assigned this Feb 11, 2015
@alan-knight
Copy link
Contributor Author

This is infeasible. It comes up a few times as wanting to parse a Date like 20150429, but that's not a good use of this library. This is for internationalization. If you want to read a hard-coded datetime format with fixed length fields you can do that much, much more efficiently. This expects to print the fields in many different ways depending on locale information, possibly not in the same order, and the field specifies are not interpreted literally. That is, MM does not necessarily mean a padded two digit date, so if there are no delimiters we really can't handle it.

@blevinstein
Copy link

For others looking for a solution to this, DateTime.parse provides this capability.
https://api.dartlang.org/stable/1.24.3/dart-core/DateTime/parse.html

@alan-knight
Copy link
Contributor Author

Well that's interesting, I didn't realize that. Thanks for pointing it out.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants