Skip to content

Commit

Permalink
feat: more time method
Browse files Browse the repository at this point in the history
  • Loading branch information
miaolz123 committed Sep 24, 2020
1 parent c5dde6b commit eb8a667
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions time/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func (t Time) UnixMilli() int64 {
return t.Time().UnixNano() / int64(Millisecond)
}

func (t Time) Add(d Duration) Time {
return New(t.Time().Add(d))
}

func (t Time) String() string {
return t.Time().Format(ISO8601Milli)
}
Expand Down
2 changes: 1 addition & 1 deletion time/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestJSON(t *testing.T) {
before := New(2008, M8, 8, 20, 8, 8, 8*1000*1000)
before := Date(2008, M8, 8, 20, 8, 8, 8*1000*1000)
str := json.MustMarshalToString(before)
after := Time{}

Expand Down

0 comments on commit eb8a667

Please sign in to comment.