This regex change should match the dotnet format with or without milliseconds
This commit is contained in:
Shannon Deminick 2021-03-23 11:09:02 +11:00 committed by GitHub
parent 51956bab1c
commit c0e7f7f7dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
export function parseNetDuration(str: string): number {
// matches dotnet duration: 00:00:00.0010000
const durationRe = /^(\d\d):(\d\d):(\d\d\.\d+)$/
const durationRe = /^(\d\d):(\d\d):(\d\d($|\.\d+$))/
const durationMatch = str.match(durationRe)
if (durationMatch === null) {
throw new Error(`Invalid format: "${str}" is not NET duration`)