mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
fix time.parse()
This commit is contained in:
parent
b1013697d1
commit
d03f0ec294
2 changed files with 9 additions and 1 deletions
|
@ -306,7 +306,7 @@ pub fn parse(s string) Time {
|
||||||
}
|
}
|
||||||
shms := s[pos..]
|
shms := s[pos..]
|
||||||
hms := shms.split(':')
|
hms := shms.split(':')
|
||||||
hour := hms[0]
|
hour := hms[0][1..]
|
||||||
minute := hms[1]
|
minute := hms[1]
|
||||||
second := hms[2]
|
second := hms[2]
|
||||||
// //////////
|
// //////////
|
||||||
|
|
|
@ -177,3 +177,11 @@ fn test_get_fmt_str() {
|
||||||
.dot, .hhmmss24, .ddmmyyyy
|
.dot, .hhmmss24, .ddmmyyyy
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_parse() {
|
||||||
|
s := '2018-01-27 12:48:34'
|
||||||
|
t := time.parse(s)
|
||||||
|
assert t.year == 2018 && t.month == 1 && t.day == 27
|
||||||
|
&& t.hour == 12 && t.minute == 48 && t.second == 34
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue