This commit is contained in:
emacsist 2016-11-11 18:08:33 +00:00 committed by GitHub
commit 7aeb16c3f2
2 changed files with 7 additions and 0 deletions

View File

@ -212,3 +212,9 @@ func TestToDuration(t *testing.T) {
assert.Equal(t, v.expected, ToDuration(v.input))
}
}
func TestStringToDate(t *testing.T) {
dateString := "2016-12-01 15:05:04"
tv, _ := time.Parse("2006-01-02 15:04:05", dateString)
assert.Equal(t, ToTime(dateString), tv)
}

View File

@ -513,6 +513,7 @@ func StringToDate(s string) (time.Time, error) {
"02 Jan 2006",
"2006-01-02 15:04:05 -07:00",
"2006-01-02 15:04:05 -0700",
"2006-01-02 15:04:05",
})
}