@@ -11,8 +11,8 @@ import (
1111func TestOne (t * testing.T ) {
1212 time .Local = time .UTC
1313 var ts time.Time
14- ts = MustParse ("2019-05-29T08:41-04 " )
15- assert .Equal (t , "2019-05-29 12:41:00 +0000 UTC" , fmt .Sprintf ("%v" , ts .In (time .UTC )))
14+ ts = MustParse ("Thu, 17 Dec 2020 15:39:13 GMT " )
15+ assert .Equal (t , "2020-12-17 15:39:13 +0000 UTC" , fmt .Sprintf ("%v" , ts .In (time .UTC )))
1616}
1717
1818type dateTest struct {
@@ -107,9 +107,10 @@ var testInputs = []dateTest{
107107 {in : "June 2nd 2012" , out : "2012-06-02 00:00:00 +0000 UTC" },
108108 {in : "June 22nd, 2012" , out : "2012-06-22 00:00:00 +0000 UTC" },
109109 {in : "June 22nd 2012" , out : "2012-06-22 00:00:00 +0000 UTC" },
110- // ?
110+ // RFC1123 = "Mon, 02 Jan 2006 15:04:05 MST"
111111 {in : "Fri, 03 Jul 2015 08:08:08 MST" , out : "2015-07-03 08:08:08 +0000 UTC" },
112- {in : "Fri, 03 Jul 2015 08:08:08 PST" , out : "2015-07-03 15:08:08 +0000 UTC" , loc : "America/Los_Angeles" },
112+ //{in: "Fri, 03 Jul 2015 08:08:08 CET", out: "2015-07-03 08:08:08 +0000 UTC"},
113+ {in : "Fri, 03 Jul 2015 08:08:08 PST" , out : "2015-07-03 16:08:08 +0000 UTC" , loc : "America/Los_Angeles" },
113114 {in : "Fri, 03 Jul 2015 08:08:08 PST" , out : "2015-07-03 08:08:08 +0000 UTC" },
114115 {in : "Fri, 3 Jul 2015 08:08:08 MST" , out : "2015-07-03 08:08:08 +0000 UTC" },
115116 {in : "Fri, 03 Jul 2015 8:08:08 MST" , out : "2015-07-03 08:08:08 +0000 UTC" },
@@ -126,7 +127,7 @@ var testInputs = []dateTest{
126127 {in : "Tue, 11 Jul 2017 04:08:03 +0200 (CEST)" , out : "2017-07-11 02:08:03 +0000 UTC" , loc : "Europe/Berlin" },
127128 // day, dd-Mon-yy hh:mm:zz TZ
128129 {in : "Fri, 03-Jul-15 08:08:08 MST" , out : "2015-07-03 08:08:08 +0000 UTC" },
129- {in : "Fri, 03-Jul-15 08:08:08 PST" , out : "2015-07-03 15 :08:08 +0000 UTC" , loc : "America/Los_Angeles" },
130+ {in : "Fri, 03-Jul-15 08:08:08 PST" , out : "2015-07-03 16 :08:08 +0000 UTC" , loc : "America/Los_Angeles" },
130131 {in : "Fri, 03-Jul 2015 08:08:08 PST" , out : "2015-07-03 08:08:08 +0000 UTC" },
131132 {in : "Fri, 3-Jul-15 08:08:08 MST" , out : "2015-07-03 08:08:08 +0000 UTC" },
132133 {in : "Fri, 03-Jul-15 8:08:08 MST" , out : "2015-07-03 08:08:08 +0000 UTC" },
@@ -326,7 +327,7 @@ var testInputs = []dateTest{
326327 {in : "2014-04-26 17:24:37.1 UTC" , out : "2014-04-26 17:24:37.1 +0000 UTC" },
327328 // This one is pretty special, it is TIMEZONE based but starts with P to emulate collions with PM
328329 {in : "2014-04-26 05:24:37 PST" , out : "2014-04-26 05:24:37 +0000 UTC" },
329- {in : "2014-04-26 05:24:37 PST" , out : "2014-04-26 12 :24:37 +0000 UTC" , loc : "America/Los_Angeles" },
330+ {in : "2014-04-26 05:24:37 PST" , out : "2014-04-26 13 :24:37 +0000 UTC" , loc : "America/Los_Angeles" },
330331 // yyyy-mm-dd hh:mm:ss+00:00
331332 {in : "2012-08-03 18:31:59+00:00" , out : "2012-08-03 18:31:59 +0000 UTC" },
332333 {in : "2017-07-19 03:21:51+00:00" , out : "2017-07-19 03:21:51 +0000 UTC" },
@@ -520,6 +521,8 @@ func TestParseErrors(t *testing.T) {
520521}
521522
522523func TestParseLayout (t * testing.T ) {
524+
525+ time .Local = time .UTC
523526 // These tests are verifying that the layout returned by ParseFormat
524527 // are correct. Above tests correct parsing, this tests correct
525528 // re-usable formatting string
@@ -546,10 +549,11 @@ func TestParseLayout(t *testing.T) {
546549 // yyyy-mm-dd hh:mm:ss +00:00
547550 {in : "2012-08-03 18:31:59 +00:00" , out : "2006-01-02 15:04:05 -07:00" },
548551 // yyyy-mm-dd hh:mm:ss +0000 TZ
549- // Golang Native Format
550- {in : "2012-08-03 18:31:59 +0000 UTC" , out : "2006-01-02 15:04:05 -0700 UTC " },
552+ // Golang Native Format = "2006-01-02 15:04:05.999999999 -0700 MST"
553+ {in : "2012-08-03 18:31:59 +0000 UTC" , out : "2006-01-02 15:04:05 -0700 MST " },
551554 // yyyy-mm-dd hh:mm:ss TZ
552- {in : "2012-08-03 18:31:59 UTC" , out : "2006-01-02 15:04:05 UTC" },
555+ {in : "2012-08-03 18:31:59 UTC" , out : "2006-01-02 15:04:05 MST" },
556+ {in : "2012-08-03 18:31:59 CEST" , out : "2006-01-02 15:04:05 MST" },
553557 // yyyy-mm-ddThh:mm:ss-07:00
554558 {in : "2009-08-12T22:15:09-07:00" , out : "2006-01-02T15:04:05-07:00" },
555559 // yyyy-mm-ddThh:mm:ss-0700
0 commit comments