diff --git a/src/format.rs b/src/format.rs index de4d407f..5a9ce0fd 100644 --- a/src/format.rs +++ b/src/format.rs @@ -43,7 +43,10 @@ fn format(w: &mut Writer, date: Option<&NaiveDate>, time: Option<&NaiveTime>, continue; } - let (head, tail) = part.slice_shift_char(); + let (head, tail) = match part.slice_shift_char() { + Some((head, tail)) => (Some(head), tail), + None => (None, ""), + }; match (head, date, time, off) { // year (Some('Y'), Some(d), _, _) => try!(write!(w, "{}", d.year())),