Skip to content

Commit

Permalink
-until now
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn authored and fiatjaf committed Dec 12, 2023
1 parent f0d90b5 commit 242b028
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions req.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ example:
Usage: "only accept events newer than this (unix timestamp)",
Category: CATEGORY_FILTER_ATTRIBUTES,
},
&cli.IntFlag{
&cli.StringFlag{
Name: "until",
Aliases: []string{"u"},
Usage: "only accept events older than this (unix timestamp)",
Expand Down Expand Up @@ -196,9 +196,16 @@ example:
return fmt.Errorf("parse error: Invalid numeric literal %q", since)
}
}
if until := c.Int("until"); until != 0 {
ts := nostr.Timestamp(until)
filter.Until = &ts
if until := c.String("until"); until != "" {
if until == "now" {
ts := nostr.Now()
filter.Until = &ts
} else if i, err := strconv.Atoi(until); err == nil {
ts := nostr.Timestamp(i)
filter.Until = &ts
} else {
return fmt.Errorf("parse error: Invalid numeric literal %q", until)
}
}
if limit := c.Int("limit"); limit != 0 {
filter.Limit = limit
Expand Down

0 comments on commit 242b028

Please sign in to comment.