Socket
Socket
Sign inDemoInstall

github.com/tj/go-naturaldate

Package Overview
Dependencies
2
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/tj/go-naturaldate

Package naturaldate provides natural date time parsing.


Version published

Readme

Source

Go Natural Date

Natural date time parsing for Go. This package was designed for parsing human-friendly relative date/time ranges in Apex Logs' command-line log search.

Examples

Here are some examples of the types of expressions currently supported, arbitrary text is currently ignored.

  • now
  • today
  • yesterday
  • 5 minutes ago
  • three days ago
  • last month
  • next month
  • one year from now
  • yesterday at 10am
  • last sunday at 5:30pm
  • sunday at 22:45
  • next January
  • last February
  • December 25th at 7:30am
  • 10am
  • 10:05pm
  • 10:05:22pm
  • Restart the server in 5 days from now
  • Remind me on the 25th of December at 7:30am
  • Message me in two weeks
  • See the tests for more examples

Direction

A default direction can be applied using WithDirection() for ambiguous expressions such as sunday, or september. By default naturaldate.Past is used, so they will be equivalent to last sunday and last september.


GoDoc

Sponsors

This project is sponsored by CTO.ai, making it easy for development teams to create and share workflow automations without leaving the command line.

And my GitHub sponsors:

FAQs

Last updated on 08 Jun 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc