xyxie пре 11 месеци
родитељ
комит
76cf93161c
2 измењених фајлова са 9 додато и 4 уклоњено
  1. 0 1
      go.mod
  2. 9 3
      utils/common.go

+ 0 - 1
go.mod

@@ -3,7 +3,6 @@ module eta/eta_index_lib
 go 1.21.7
 
 require (
-	github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
 	github.com/beego/bee/v2 v2.1.0
 	github.com/beego/beego/v2 v2.1.0
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible

+ 9 - 3
utils/common.go

@@ -8,7 +8,6 @@ import (
 	"encoding/hex"
 	"encoding/json"
 	"fmt"
-	"github.com/araddon/dateparse"
 	"github.com/shopspring/decimal"
 	"image"
 	"image/png"
@@ -1204,11 +1203,18 @@ func GetEdbRefreshEndDate(endDate string) string {
 }
 
 func DealExcelDate(date string) (newDate time.Time, err error) {
-	newDate, err = dateparse.ParseAny(date)
+	/*newDate, err = dateparse.ParseAny(date)
 	if err != nil {
 		return
 	}
 
-	newDate = time.Date(newDate.Year(), newDate.Month(), newDate.Day(), 0, 0, 0, 0, time.Local)
+	newDate = time.Date(newDate.Year(), newDate.Month(), newDate.Day(), 0, 0, 0, 0, time.Local)*/
+	if strings.Contains(date, "/") {
+		newDate, err = time.ParseInLocation("2006/01/02", date, time.Local)
+		return
+	} else {
+		newDate, err = time.ParseInLocation(FormatDate, date, time.Local)
+		return
+	}
 	return
 }