[Issue 16053] New: SysTime.fromIsoExtString don't work if nanoseconds are presented

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 21 12:52:43 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16053

          Issue ID: 16053
           Summary: SysTime.fromIsoExtString don't work if nanoseconds are
                    presented
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: chalucha at gmail.com

Just came across the REST API which returns time in format like this:
2016-05-21T14:13:25.032937439Z

Which results in Invalid ISO Extended String exception.

Accoording to wikipedia, there is no limit for decimal fraction:
"There is no limit on the number of decimal places for the decimal fraction.
However, the number of decimal places needs to be agreed to by the
communicating parties."

There is this check in a fracSecsFromISOString method:
enforce(!str.empty && str.length <= 7, new DateTimeException("Invalid ISO
String"));

It would be nice if this method can handle this kind of input strings even
though that nanoseconds would be thrown away (probably should be documented
behaviour)

Is this legit?

--


More information about the Digitalmars-d-bugs mailing list