Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions when.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type Result struct {
Source string
// Time is an output time
Time time.Time
// Duration is an output relative duration
Duration time.Duration
}

// Parse returns Result and error if any. If have not matches it returns nil, nil.
Expand Down Expand Up @@ -113,6 +115,8 @@ func (p *Parser) Parse(text string, base time.Time) (*Result, error) {
return nil, errors.Wrap(err, "bind context")
}

res.Duration = ctx.Duration

return &res, nil
}

Expand Down
Loading