desktop-dart / duration

Utilities to make working with 'Duration's easier.
BSD 3-Clause "New" or "Revised" License
53 stars 47 forks source link

Error when parsing microseconds from string #28

Closed micshome closed 3 years ago

micshome commented 4 years ago

When parsing a string with us function tryParseDuration always returns Format error

Example: tryParseDuration('1us');

Reason is a mistake in validation RegExp, extra ] after "us":

final match = RegExp(r'^(\d+)(d|h|m|s|ms|us])$').matchAsPrefix(part);

in file duration-2.0.15/lib/src/parse/parse.dart, line 13

tejainece commented 3 years ago

Thanks! Fixed it.