This library provides support for parsing datemath expressions compatibly with Elasticsearch datemath expressions. These are useful for allowing users to specify, and for encoding, relative dates. Examples:
now+15m: 15 minutes from nownow-1w+1d: one day after on week ago2015-05-05T00:00:00||+1M: one month after 2019-05-05
These expressions will seem familiar if you have used Grafana or Kibana.
Example usage:
expr, _ := datemath.Parse("now-15m")
fmt.Println(t.Time(datemath.WithNow(now)))See package documentation for usage and more examples.
See CONTRIBUTING.md.