dateparse

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dateparse provides natural language date parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValid

func IsValid(input string) bool

IsValid returns true if the input is a recognized date format.

func MustParse

func MustParse(input string) string

MustParse parses a date and panics if it fails. Use this only for known-good inputs like constants.

func Parse

func Parse(input string) string

Parse parses a natural language date string and returns a date in YYYY-MM-DD format. Supported formats:

  • today, tomorrow, yesterday
  • monday, tuesday, ... (next occurrence, same day = next week)
  • next monday, next tuesday, ... (at least 7 days from now)
  • next week, next month
  • eow (end of week - Friday)
  • eom (end of month)
  • +N (N days from now)
  • in N days, in N weeks
  • YYYY-MM-DD (passthrough)

func ParseFrom

func ParseFrom(input string, now time.Time) string

ParseFrom parses a date relative to the given reference time. This is useful for testing and for parsing relative to a specific date.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL