Skip to content

Commit

Permalink
Stats: fix time format
Browse files Browse the repository at this point in the history
  • Loading branch information
kshvakov committed Nov 28, 2019
1 parent 2d08b20 commit eb0204e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package mailgun

import (
"context"
"strconv"
"time"
)

const iso8601date = "2006-01-02"

// Stats on accepted messages
type Accepted struct {
Incoming int `json:"incoming"`
Expand Down Expand Up @@ -91,10 +90,10 @@ func (mg *MailgunImpl) GetStats(ctx context.Context, events []string, opts *GetS

if opts != nil {
if !opts.Start.IsZero() {
r.addParameter("start", opts.Start.Format(iso8601date))
r.addParameter("start", strconv.Itoa(int(opts.Start.Unix())))
}
if !opts.End.IsZero() {
r.addParameter("end", opts.End.Format(iso8601date))
r.addParameter("end", strconv.Itoa(int(opts.End.Unix())))
}
if opts.Resolution != "" {
r.addParameter("resolution", string(opts.Resolution))
Expand Down

0 comments on commit eb0204e

Please sign in to comment.