dateparse

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dateparse parses the human date and priority inputs nt accepts on the CLI and in the TUI (SPEC §7.3), kept in one place so both surfaces agree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Date

func Date(s string) (string, bool)

Date accepts today, tomorrow, weekday names, +Nd, and YYYY-MM-DD, optionally with a time-of-day: an ISO "YYYY-MM-DD[T ]HH:MM", or a clock appended to any of the keyword forms ("today 5pm", "fri 17:00", "tomorrow 9am"). A timed value is normalized to "YYYY-MM-DDTHH:MM". Empty / "none" / "-" clears the date (returns "", true). ok is false on an unparseable value.

func DatePart added in v0.4.0

func DatePart(s string) string

DatePart returns the YYYY-MM-DD prefix of a (possibly time-bearing) date value, for date-granularity comparisons (agenda buckets, overdue checks).

func Duration added in v0.5.0

func Duration(s string) (int, bool)

Duration parses a human time estimate/elapsed into whole minutes: "90m", "2h", "1h30m", "1.5h", or a bare integer (minutes). ok is false on an unparseable or negative value. Used for task est:/spent: tracking (T6).

func FmtDuration added in v0.5.0

func FmtDuration(mins int) string

FmtDuration renders whole minutes as a compact "1h30m" / "2h" / "45m".

func Priority

func Priority(s string) (byte, bool)

Priority maps a priority input to a todo.txt priority byte. It accepts the friendly aliases high/med/low, and any single letter A–Z (todo.txt's full priority range, e.g. "D"). "none"/"" clears it (returns 0, true).

Types

This section is empty.

Jump to

Keyboard shortcuts

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