dateparse

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dateparse provides flexible date and time parsing utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDate

func FormatDate(t time.Time) string

FormatDate formats a date for display (YYYY-MM-DD).

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration as hours (e.g., "1.5h").

func Parse

func Parse(s string) (time.Time, error)

Parse parses a date string with flexible formats. Supports:

  • "today", "yesterday", "tomorrow"
  • "N days ago", "N weeks ago", "N months ago"
  • "last week", "last monday", etc.
  • ISO 8601: "2024-01-15"
  • Common formats via dateparse library

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses duration strings. Supports:

  • "1.5h", "2h" (hours)
  • "1h30m" (hours and minutes)
  • "90m" (minutes only)

func ParseTimeOfDay

func ParseTimeOfDay(s string) (hour, minute int, err error)

ParseTimeOfDay parses time strings: "9:00", "9:00am", "14:30".

Types

This section is empty.

Jump to

Keyboard shortcuts

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