Skip to content

Commit

Permalink
Fix CLI parseTime for listworkflow (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
vancexu authored Jun 7, 2018
1 parent 34c6e50 commit 7154288
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tools/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,9 @@ func (s *cliAppSuite) TestObserveWorkflowWithID() {
err = s.app.Run([]string{"", "--do", domainName, "workflow", "observeid", "wid", "-sd"})
s.Nil(err)
}

func (s *cliAppSuite) TestParseTime() {
s.Equal(int64(100), parseTime("", 100))
s.Equal(int64(1528383845000000000), parseTime("2018-06-07T15:04:05+00:00", 0))
s.Equal(int64(1528383845000000000), parseTime("1528383845000000000", 0))
}
2 changes: 1 addition & 1 deletion tools/cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ func parseTime(timeStr string, defaultValue int64) int64 {
}

// try to parse
parsedTime, err := time.Parse(defaultTimeFormat, timeStr)
parsedTime, err := time.Parse(defaultDateTimeFormat, timeStr)
if err == nil {
return parsedTime.UnixNano()
}
Expand Down

0 comments on commit 7154288

Please sign in to comment.