Hi,
my application is configured to use the standard .Net format for TimeSpan (0.00:00:00) instead of the xsd duration format (JsConfig.TimeSpanHandler = TimeSpanHandler.StandardFormat;
). Can you extend the TimeSpan.parse method to support the .Net format? A small regex could help with this issue:
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
double ms = 0.0;
Pattern p = Pattern.compile("^(?<days>\\d*)?.?(?<hours>\\d\\d)\\:(?<minutes>\\d\\d)\\:(?<seconds>\\d\\d).?(?<ms>\\d*)?$$"); // matches 2.00:00:00, 00:00:00, 00:00:00.234 or 2.00:00:00.123
Matcher m = p.matcher("2.05:22:11.123");
if (m.matches()){
if (m.group("days").length() > 0) {
days = Integer.parseInt(m.group("days"));
}
hours += Integer.parseInt(m.group("hours"));
minutes += Integer.parseInt(m.group("minutes"));
seconds += Integer.parseInt(m.group("seconds"));
if (m.group("ms").length() > 0) {
ms = Integer.parseInt(m.group("ms"));
}
}
Thanks