Sdk: Add Duration.parse

Created on 13 Jan 2014  路  8Comments  路  Source: dart-lang/sdk

_This issue was originally filed by @seaneagan_


Duration.parse based on ISO-8601 (like DateTime.parse) would be useful for things like command line options, configuration files, url parameters.

Java: http://download.java.net/jdk8/docs/api/java/time/Duration.html

Go has it's own formatting, which I like better, but is not standardized AFAIK: http://golang.org/pkg/time/#ParseDuration

area-library core-2 library-core type-enhancement

Most helpful comment

I also needed this today.

All 8 comments

_This comment was originally written by @seaneagan_


Would probably want to change Duration.toString() to match ISO-8601 or whatever format is chosen for Duration.parse.

_Added Area-Library, Library-Core, Triaged labels._

_Removed Type-Defect label._
_Added Type-Enhancement label._

Issue #19891 has been merged into this issue.

Yep, this would have been nice to have today.

I also needed this today.

Worked on this and added support for it in https://dart-review.googlesource.com/c/sdk/+/118566.

I would like to have a toIso8601String method in addition to parsing.

Was this page helpful?
0 / 5 - 0 ratings