1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

time: do not panic on time.new_time({unix: 1608854400}).str()

This commit is contained in:
Delyan Angelov
2020-09-16 22:13:20 +03:00
parent 96b7cce810
commit e2e683199d
2 changed files with 8 additions and 5 deletions

View File

@ -133,6 +133,9 @@ pub fn utc() Time {
// smonth returns month name.
pub fn (t Time) smonth() string {
if t.month <= 0 || t.month > 12 {
return '---'
}
i := t.month - 1
return months_string[i * 3..(i + 1) * 3]
}