ExLedger.Parser.Timeclock (ex_ledger v0.5.6)

Parses and reports on timeclock entries.

Timeclock entries use the format: i YYYY/MM/DD HH:MM:SS ACCOUNT [PAYEE] ; check-in o YYYY/MM/DD HH:MM:SS ; check-out (lowercase) O YYYY/MM/DD HH:MM:SS ; check-out cleared (uppercase)

Summary

Functions

Formats a timeclock report as a string.

Parses timeclock entries from input text.

Aggregates timeclock entries by account and returns total hours.

Types

time_entry()

@type time_entry() :: %{
  account: String.t(),
  start: NaiveDateTime.t(),
  stop: NaiveDateTime.t(),
  payee: String.t() | nil,
  cleared: boolean(),
  duration_seconds: non_neg_integer()
}

Functions

format_timeclock_report(report)

@spec format_timeclock_report(%{required(String.t()) => float()}) :: String.t()

Formats a timeclock report as a string.

parse_timeclock_entries(input)

@spec parse_timeclock_entries(String.t()) :: [time_entry()]

Parses timeclock entries from input text.

Returns a list of completed time entries (check-in paired with check-out). Warns to stderr about any unclosed check-ins.

timeclock_report(entries)

@spec timeclock_report([time_entry()]) :: %{required(String.t()) => float()}

Aggregates timeclock entries by account and returns total hours.