-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove auto conversion of XML attributes based on value
- Loading branch information
Michal Dorner
committed
Jan 24, 2021
1 parent
1a9ca69
commit 40b5f47
Showing
6 changed files
with
44 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export function parseNetDuration(str: string): number { | ||
// matches dotnet duration: 00:00:00.0010000 | ||
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`) | ||
} | ||
|
||
const [_, hourStr, minStr, secStr] = durationMatch | ||
return (parseInt(hourStr) * 3600 + parseInt(minStr) * 60 + parseFloat(secStr)) * 1000 | ||
} | ||
|
||
export function parseIsoDate(str: string): Date { | ||
const isoDateRe = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)$/ | ||
if (str === undefined || !isoDateRe.test(str)) { | ||
throw new Error(`Invalid format: "${str}" is not ISO date`) | ||
} | ||
|
||
return new Date(str) | ||
} |
This file was deleted.
Oops, something went wrong.