More tests and fixes

This commit is contained in:
Jonathan Putney
2019-11-14 16:07:42 -05:00
parent caa5977a4b
commit 929176fb3e
14 changed files with 385 additions and 238 deletions

View File

@@ -44,7 +44,7 @@ export function getSecondsAsHHMMSS(totalSeconds: Number) {
export function getSecondsAsISODuration(seconds: Number) {
// SCORM spec does not deal with negative durations, give zero back
if (!seconds || seconds <= 0) {
return 'P0S';
return 'PT0S';
}
let duration = 'P';
@@ -61,6 +61,11 @@ export function getSecondsAsISODuration(seconds: Number) {
}
if (value) {
if ((duration.indexOf('D') > 0 ||
sign === 'H' || sign === 'M' || sign === 'S') &&
duration.indexOf('T') === -1) {
duration += 'T';
}
duration += `${value}${sign}`;
}
});