瀏覽代碼

refactor(date): use an else-if instead of two if statements

Julien Voisin 1 年之前
父節點
當前提交
7eb1d15315
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      internal/reader/date/parser.go

+ 1 - 3
internal/reader/date/parser.go

@@ -354,9 +354,7 @@ func parseLocalTimeDates(layout, ds string) (t time.Time, err error) {
 	// Workaround for dates that don't use GMT.
 	// Workaround for dates that don't use GMT.
 	if strings.HasSuffix(ds, "PST") || strings.HasSuffix(ds, "PDT") {
 	if strings.HasSuffix(ds, "PST") || strings.HasSuffix(ds, "PDT") {
 		loc, _ = time.LoadLocation("America/Los_Angeles")
 		loc, _ = time.LoadLocation("America/Los_Angeles")
-	}
-
-	if strings.HasSuffix(ds, "EST") || strings.HasSuffix(ds, "EDT") {
+	} else if strings.HasSuffix(ds, "EST") || strings.HasSuffix(ds, "EDT") {
 		loc, _ = time.LoadLocation("America/New_York")
 		loc, _ = time.LoadLocation("America/New_York")
 	}
 	}