Skip to content

Commit

Permalink
types: duration: Deal with empty as PT0S
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Sep 14, 2024
1 parent 80050d9 commit be4da14
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xsd-types/src/types/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ impl FromStr for Duration {

let mut dur: Duration = Default::default();
let mut context = ParsingContext::new();

if s.is_empty() {
return Ok(dur);
}

for (i, c) in s.chars().enumerate() {
match c {
'-' => {
Expand Down

0 comments on commit be4da14

Please sign in to comment.