diff --git a/executor.go b/executor.go index 5ac546805..f29fdfe9f 100644 --- a/executor.go +++ b/executor.go @@ -537,7 +537,7 @@ func (e *Executor) executeSetBit(ctx context.Context, db string, c *pql.Call, op var timestamp *time.Time sTimestamp, ok := c.Args["timestamp"].(string) if ok { - t, err := time.Parse("2006-01-02T15:04:05", sTimestamp) + t, err := time.Parse(TimeFormat, sTimestamp) if err != nil { return false, fmt.Errorf("invalid date: %s", sTimestamp) } diff --git a/executor_test.go b/executor_test.go index 73ddab4e4..9cdc663af 100644 --- a/executor_test.go +++ b/executor_test.go @@ -420,7 +420,7 @@ func TestExecutor_Execute_Remote_SetBit_With_Timestamp(t *testing.T) { s.Handler.Executor.ExecuteFn = func(ctx context.Context, db string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { if db != `d` { t.Fatalf("unexpected db: %s", db) - } else if query.String() != `SetBit(frame="f", id=10, profileID=2, timestamp="2016-12-11T10:09:07")` { + } else if query.String() != `SetBit(frame="f", id=10, profileID=2, timestamp="2016-12-11T10:09")` { t.Fatalf("unexpected query: %s", query.String()) } remoteCalled = true @@ -445,7 +445,7 @@ func TestExecutor_Execute_Remote_SetBit_With_Timestamp(t *testing.T) { } e := NewExecutor(idx.Index, c) - if _, err := e.Execute(context.Background(), "d", MustParse(`SetBit(id=10, frame=f, profileID=2, timestamp="2016-12-11T10:09:07")`), nil, nil); err != nil { + if _, err := e.Execute(context.Background(), "d", MustParse(`SetBit(id=10, frame=f, profileID=2, timestamp="2016-12-11T10:09")`), nil, nil); err != nil { t.Fatal(err) } diff --git a/pql/ast.go b/pql/ast.go index dec73ac2b..3168e5ec0 100644 --- a/pql/ast.go +++ b/pql/ast.go @@ -100,8 +100,7 @@ func (c *Call) String() string { case []uint64: fmt.Fprintf(&buf, "%v=%s", key, joinUint64Slice(v)) case time.Time: - layout := "2006-01-02T15:04:05" - fmt.Fprintf(&buf, "%v=\"%s\"", key, v.Format(layout)) + fmt.Fprintf(&buf, "%v=\"%s\"", key, v.Format(TimeFormat)) default: fmt.Fprintf(&buf, "%v=%v", key, v) }