datetime

package
v0.1.7-rc.11 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package datetime provides time and date tools for agents. LLMs are notoriously poor at temporal reasoning — this package gives them precise control over current time queries, timezone conversions, date arithmetic, duration calculations, and format parsing.

Problem: LLMs have no concept of "now" and cannot reliably compute time differences, timezone conversions, or date arithmetic. This package provides a deterministic time engine that handles these operations correctly.

Supported operations:

  • now — current time in any timezone
  • convert — timezone conversion between IANA zones
  • add / subtract — date arithmetic (add 3 days, subtract 2 hours, etc.)
  • diff — duration between two dates
  • parse — auto-detect and parse 100+ date formats
  • format — format dates into any Go time layout

Dependencies:

  • github.com/araddon/dateparse — auto-detects 100+ date formats (2.1k+ ⭐)
  • Go stdlib time — IANA timezone database
  • No external system dependencies

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ToolProvider

type ToolProvider struct{}

ToolProvider wraps the datetime tool and satisfies the tools.ToolProviders interface.

func NewToolProvider

func NewToolProvider() *ToolProvider

NewToolProvider creates a ToolProvider for the datetime tool.

func (*ToolProvider) GetTools

func (p *ToolProvider) GetTools() []tool.Tool

GetTools returns the datetime tool.

Jump to

Keyboard shortcuts

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