Skip to content

Commit

Permalink
Improve the refine function for fixing duration data
Browse files Browse the repository at this point in the history
  • Loading branch information
johardi committed Jul 30, 2017
1 parent 315c806 commit 82348be
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/components/search/cse-data.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ function(schemaorgVocab) {
var duration = moment.duration(value);
if (duration._milliseconds != 0) {
return duration.as(unit);
} else {
return autoFixDurationData(value);
} else { // invalid ISO8601 value
if (value.charAt(0) !== "P") {
var newValue = "P" + value;
return refineDurationData(newValue, unit);
} else { // give up
return autoFixDurationData(value);
}
}
}

Expand Down

0 comments on commit 82348be

Please sign in to comment.