diff --git a/routes/compat/wakatime/v1/summaries.go b/routes/compat/wakatime/v1/summaries.go index 62102e8..0bbf7a6 100644 --- a/routes/compat/wakatime/v1/summaries.go +++ b/routes/compat/wakatime/v1/summaries.go @@ -69,12 +69,17 @@ func (h *SummariesHandler) loadUserSummaries(r *http.Request) ([]*models.Summary var start, end time.Time if rangeParam != "" { + // range param takes precedence if err, parsedFrom, parsedTo := utils.ResolveInterval(rangeParam); err == nil { start, end = parsedFrom, parsedTo } else { return nil, errors.New("invalid 'range' parameter"), http.StatusBadRequest } + } else if err, parsedFrom, parsedTo := utils.ResolveInterval(rangeParam); err == nil && start == end { + // also accept start param to be a range param + start, end = parsedFrom, parsedTo } else { + // eventually, consider start and end params a date var err error start, err = time.Parse(time.RFC3339, strings.Replace(startParam, " ", "+", 1))