Skip to content

Numbers, dates and times ​

Numbers ​

GoMock fileMatches
GreaterThan(n), GTgreater, gtA number, or text that reads as one, greater than n.
GreaterThanOrEqual(n), GTEgreatereq, gteGreater than or equal to n.
LessThan(n)less, ltLess than n.
LessThanOrEqual(n), LTElesseq, lteLess than or equal to n.

Dates and times ​

[before, x], [after, x] and [equalDateTime, x] (eqdt) compare a date and time in RFC 3339, in ISO 8601 without a zone, or in an HTTP format. x is one of those, or now, and either may end with an offset: "now +3 days", "2026-01-01T00:00:00Z -2 weeks".

Options: truncate_expected and truncate_actual, each one of first minute of hour, first hour of day, first day of month, first day of next month, last day of month, first day of year, first day of next year and last day of year; truncate_last: true to offset first; actual_format with a Go layout, such as 02/01/2006; local_time: true to compare wall clocks. An x without a zone is local, as with local_time; a request's date and time without a zone, against an x with one, is read in the server's zone.

In Go: Before, After, EqualDateTime, BeforeNow, AfterNow and EqualDateTimeNow, with typed options such as ExpectedOffset(3, match.Days).

yaml
request:
  header:
    X-Date: [after, "now -1 hours"]
  query:
    until: [before, "now +15 days", {truncate_expected: first day of month}]