Simplify date parsing, dont need ms etc

This commit is contained in:
Aaron Raddon 2017-06-25 19:12:09 -07:00
parent f0482b5ca2
commit 1bef41e8d2

View File

@ -525,66 +525,10 @@ iterRunes:
// 2006-01-02T15:04:05.9999-07:00 // 2006-01-02T15:04:05.9999-07:00
// 2006-01-02T15:04:05.999-07:00 // 2006-01-02T15:04:05.999-07:00
// 2006-01-02T15:04:05.99-07:00 // 2006-01-02T15:04:05.99-07:00
if len(datestr) == len("2006-01-02T15:04:05.999999999-07:00") { if t, err := time.Parse("2006-01-02T15:04:05-07:00", datestr); err == nil {
if t, err := time.Parse("2006-01-02T15:04:05.999999999-07:00", datestr); err == nil { return t, nil
return t, nil } else {
} else { return time.Time{}, err
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.99999999-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.99999999-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.9999999-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.9999999-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.999999-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.999999-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.99999-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.99999-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.9999-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.9999-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.999-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.999-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.99-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.99-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05.9-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05.9-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} else if len(datestr) == len("2006-01-02T15:04:05-07:00") {
if t, err := time.Parse("2006-01-02T15:04:05-07:00", datestr); err == nil {
return t, nil
} else {
return time.Time{}, err
}
} }
case ST_DIGITDASHTZDIGIT: case ST_DIGITDASHTZDIGIT:
// With a time-zone at end after Z // With a time-zone at end after Z