Skip to main content

Module timeline_groups

Module timeline_groups 

Source
Expand description

Timeline date bucketing — a faithful port of timeline-groups.ts.

Adapts the JS Date-based logic to chrono::Local. ymd takes 1-based year/month/day ints (the JS ymd(new Date(...)) used 0-based months; our API is 1-based and documented). format_date parses an RFC3339 string to local time and formats it as YYYY-MM-DD, returning "" on null/invalid.

Structs§

TimelineBucket
A timeline bucket: a label plus the points that fall under it.

Functions§

bucket_label
Bucket label for a single point relative to now: "Working tree" for worktree points, else "Today" / "Yesterday" / "Earlier".
format_date
Parse an RFC3339 string, convert to local time, format as YYYY-MM-DD. Returns "" for None or an unparseable value (parity with the JS new Date(value) + ymd, which is local-timezone).
group_timeline
Group points into ordered buckets by label, preserving first-seen order.
ymd
Zero-padded YYYY-MM-DD from 1-based year/month/day.