This commit is contained in:
@@ -24,6 +24,7 @@ func (h *Handler) SnapshotAggregateForce(w http.ResponseWriter, r *http.Request)
|
||||
snapshotType := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("type")))
|
||||
dateValue := strings.TrimSpace(r.URL.Query().Get("date"))
|
||||
startedAt := time.Now()
|
||||
loc := time.Now().Location()
|
||||
|
||||
if snapshotType == "" || dateValue == "" {
|
||||
h.Logger.Warn("Snapshot aggregation request missing parameters",
|
||||
@@ -43,7 +44,7 @@ func (h *Handler) SnapshotAggregateForce(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
switch snapshotType {
|
||||
case "daily":
|
||||
parsed, err := time.Parse("2006-01-02", dateValue)
|
||||
parsed, err := time.ParseInLocation("2006-01-02", dateValue, loc)
|
||||
if err != nil {
|
||||
h.Logger.Warn("Snapshot aggregation invalid daily date format", "date", dateValue)
|
||||
writeJSONError(w, http.StatusBadRequest, "date must be YYYY-MM-DD")
|
||||
@@ -56,7 +57,7 @@ func (h *Handler) SnapshotAggregateForce(w http.ResponseWriter, r *http.Request)
|
||||
return
|
||||
}
|
||||
case "monthly":
|
||||
parsed, err := time.Parse("2006-01", dateValue)
|
||||
parsed, err := time.ParseInLocation("2006-01", dateValue, loc)
|
||||
if err != nil {
|
||||
h.Logger.Warn("Snapshot aggregation invalid monthly date format", "date", dateValue)
|
||||
writeJSONError(w, http.StatusBadRequest, "date must be YYYY-MM")
|
||||
|
||||
Reference in New Issue
Block a user