mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make sure input value=12:30:01 doesn't turn into 12:30:1
This commit is contained in:
parent
419954474b
commit
6dc8f67f8f
3 changed files with 70 additions and 0 deletions
|
@ -474,7 +474,15 @@ impl DOMString {
|
|||
"{:04}-{:02}-{:02}T{:02}:{:02}",
|
||||
year, month, day, hour, minute
|
||||
);
|
||||
} else if second < 10.0 {
|
||||
// we need exactly one leading zero on the seconds,
|
||||
// whatever their total string length might be
|
||||
self.0 = format!(
|
||||
"{:04}-{:02}-{:02}T{:02}:{:02}:0{}",
|
||||
year, month, day, hour, minute, second
|
||||
);
|
||||
} else {
|
||||
// we need no leading zeroes on the seconds
|
||||
self.0 = format!(
|
||||
"{:04}-{:02}-{:02}T{:02}:{:02}:{}",
|
||||
year, month, day, hour, minute, second
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue