worktime

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package worktime parses the durations and dates of YouTrack work items.

It mirrors workit's YouTrack time tracking (packages/workit-core youtrack.ts: youTrackParseDuration and youTrackWorkDateMs) so workit can hand its input to ytrack unchanged. Where workit silently drops part of an input ("1h30" is 60 minutes, "1.5h" is 300), ytrack refuses it instead.

Index

Constants

View Source
const DateLayout = "2006-01-02"

DateLayout is the layout of work item dates on the command line and in output.

Variables

This section is empty.

Functions

func FormatMinutes

func FormatMinutes(minutes int) string

FormatMinutes renders minutes as YouTrack shows durations without a work schedule: "1h 30m", "45m", "2h".

func Location

func Location(name string, fallback *time.Location) (*time.Location, error)

Location returns the timezone that decides today's date for "auto": name when set (an IANA zone such as Europe/Madrid), otherwise fallback, the process timezone (which honours TZ). It mirrors workit, where the youtrack.json timezone wins over the process timezone.

func ParseDay

func ParseDay(raw string) (time.Time, error)

ParseDay parses a YYYY-MM-DD day as midnight UTC. It rejects days that do not exist, such as 2026-02-30, and years outside 1970-9999.

func ParseDuration

func ParseDuration(s string) (int, error)

ParseDuration returns the minutes in a duration such as 1h30m, 90m, 1.5h, "1 hour 30 minutes" or a bare number of minutes (90). Parts add up and case is ignored, as in workit. The result must be a positive whole number of minutes. Days and weeks are refused: their length depends on the YouTrack instance's work schedule.

func WorkDate

func WorkDate(raw string, now time.Time, loc *time.Location) (time.Time, error)

WorkDate resolves a work item date: "auto" (or "") is today's calendar day in loc at the instant now; otherwise raw is a YYYY-MM-DD day (one-digit months and days are accepted, as in workit). The result is that day at midnight UTC, which is how YouTrack stores a work item's date, so a given day is the same instant whatever timezone ytrack runs in.

Types

This section is empty.

Jump to

Keyboard shortcuts

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