duration

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 5 Imported by: 1 module, 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 duration provides helpers for converting between flight time representations. All internal storage uses integer minutes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecimalHoursToMinutes

func DecimalHoursToMinutes(hours float64) int

DecimalHoursToMinutes converts decimal hours to integer minutes via rounding.

func FormatColonHM

func FormatColonHM(minutes int) string

FormatColonHM returns a colon-separated hours:minutes string, e.g. "1:23". Suitable for EASA logbook PDF export.

func FormatDecimal

func FormatDecimal(minutes int) string

FormatDecimal returns a decimal hours string with 1 decimal place, e.g. "1.4h".

func FormatHM

func FormatHM(minutes int) string

FormatHM returns a human-readable hours:minutes string, e.g. "1h 23m".

func MinutesToDecimalHours

func MinutesToDecimalHours(minutes int) float64

MinutesToDecimalHours converts minutes to decimal hours for display/export.

func ParseDuration

func ParseDuration(input string) (int, error)

ParseDuration parses a flexible duration string into integer minutes. Accepted formats:

  • "1:23" or "01:23" → 83 minutes (colon-separated hours:minutes)
  • "1h23m" or "1h 23m" → 83 minutes
  • "1h" → 60 minutes
  • "23m" → 23 minutes
  • "83" → 83 minutes (bare integer = minutes)
  • "1.38" or "1.5" → decimal hours converted to minutes (83 or 90)
  • "1.5h" or "1,5" → decimal-hour variants (h suffix, comma separator)

Types

This section is empty.

Jump to

Keyboard shortcuts

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