2
0
mirror of https://github.com/araddon/dateparse.git synced 2026-02-02 06:17:53 +00:00

New date format 2020-07-20+00:00 fixes #110

This commit is contained in:
Aaron Raddon
2021-02-06 16:14:29 -08:00
parent 36fa6fb41d
commit 0eec95c9db
4 changed files with 49 additions and 13 deletions

View File

@@ -11,8 +11,8 @@ import (
func TestOne(t *testing.T) {
time.Local = time.UTC
var ts time.Time
ts = MustParse("Thu, 17 Dec 2020 15:39:13 GMT")
assert.Equal(t, "2020-12-17 15:39:13 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
ts = MustParse("2020-07-20+08:00")
assert.Equal(t, "2020-07-19 16:00:00 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
}
type dateTest struct {
@@ -236,6 +236,9 @@ var testInputs = []dateTest{
{in: "2014-04-02", out: "2014-04-02 00:00:00 +0000 UTC"},
{in: "2014-03-31", out: "2014-03-31 00:00:00 +0000 UTC"},
{in: "2014-4-2", out: "2014-04-02 00:00:00 +0000 UTC"},
// yyyy-mm-dd-07:00
{in: "2020-07-20+08:00", out: "2020-07-19 16:00:00 +0000 UTC"},
{in: "2020-07-20+0800", out: "2020-07-19 16:00:00 +0000 UTC"},
// dd-mmm-yy
{in: "28-Feb-02", out: "2002-02-28 00:00:00 +0000 UTC"},
{in: "15-Jan-18", out: "2018-01-15 00:00:00 +0000 UTC"},