Skip to content

build(deps): replace htp with chrono-english#1256

Merged
pamburus merged 1 commit intomasterfrom
feature/htp
Jan 10, 2026
Merged

build(deps): replace htp with chrono-english#1256
pamburus merged 1 commit intomasterfrom
feature/htp

Conversation

@pamburus
Copy link
Copy Markdown
Owner

@pamburus pamburus commented Jan 10, 2026

Replace htp with chrono-english for human-readable time parsing

Summary

This PR replaces the htp time parsing library with chrono-english for parsing human-readable time expressions in filter options like --since and --until.

Motivation

The htp library is unmaintained, while chrono-english is an actively maintained library with broader community support and similar functionality for parsing English date/time expressions.

What Changed

❌ No Longer Supported

Expression htp chrono-english Replacement
"friday at 19:00" ✅ Works ❌ Error Use "last friday 19:00"
"last friday at 19:00" ✅ Works ❌ Error Use "last friday 19:00"
"monday at 6 am" ✅ Works ❌ Error Use "last monday 6:00"

✨ Newly Supported

Expression htp chrono-english Notes
"last friday 19:00" ❌ Error ✅ Works Time without "at" keyword
"last April" ❌ Error ✅ Works Month references (past)
"april" ❌ Error ✅ Works Bare month (auto-prefixed with "last")
"dec" ❌ Error ✅ Works Short month name (auto-prefixed)
"1 April 2025" ❌ Error ✅ Works Long date format
"2025-12-15" ❌ Error ✅ Works ISO date format
"2025" ❌ Error ✅ Works Year-only (Jan 1st)
"2026" ❌ Error ✅ Works Year-only (Jan 1st)

✅ Works the Same in Both

Expression Result Use Case
"1 hour ago" 1 hour ago ✅ Common
"2 days ago" 2 days ago ✅ Common
"1 week ago" 1 week ago ✅ Common
"now" Current time ✅ Common
"last friday" Previous Friday ✅ Common
"last monday" Previous Monday ✅ Common
"7am" Today at 7 AM ✅ Common
"19:00" Today at 19:00 ✅ Common
-1h, -2d, -1w Explicit past durations ✅ Common

Migration Guide

Must Update

If you're using weekday with "at" + time:

# Before (htp)
hl --since "friday at 19:00" app.log
hl --since "monday at 6 am" app.log

# After (chrono-english) - remove "at", add "last"
hl --since "last friday 19:00" app.log
hl --since "last monday 6:00" app.log

No Changes Needed

These continue to work identically:

# Relative durations (most common usage)
hl --since -1h app.log
hl --since -2d app.log
hl --since -1w app.log

# Natural language "ago" syntax
hl --since "1 hour ago" app.log
hl --since "2 days ago" app.log

# Named days
hl --since yesterday app.log
hl --since today app.log

# Weekdays with "last" modifier
hl --since "last friday" app.log
hl --since "last monday" app.log

# Bare times
hl --since 7am app.log
hl --since 19:00 app.log

New Capabilities

Month-based filtering

# Logs from last April
hl --since "last April" app.log

# Logs from specific date
hl --since "1 April 2025" app.log
hl --since "2025-12-15" app.log

Weekday with time (no "at" needed)

# Last Friday at 7 PM
hl --since "last friday 19:00" app.log

# Last Monday at 9 AM
hl --since "last monday 9:00" app.log

Common Patterns

Use Case Syntax
Last hour --since -1h or --since "1 hour ago"
Last day --since -1d or --since yesterday
Last week --since -1w or --since "1 week ago"
Last Friday --since "last friday" or --since friday
Last Friday evening --since "last friday 19:00"
Last month (April) --since "last April" or --since april

✨ = New capability

Technical Details

  • Dependency change: htp (git fork) → chrono-english 0.1 (crates.io)
  • Dialect: Uses Dialect::Us for consistent date interpretation
  • Backward compatibility workarounds:
    • Bare weekday names (e.g., "friday") are automatically prefixed with "last " to maintain htp behavior
    • Bare month names (e.g., "april", "dec") are automatically prefixed with "last " for consistent behavior
    • "today" and "yesterday" are adjusted to start-of-day (00:00) instead of current time
  • Ambiguity prevention: Bare durations like 1h, 2d are rejected to prevent confusion
  • Timezone handling: Honors --time-zone and --local options as before

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.19%. Comparing base (b1c1bc0) to head (a3794c7).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1256      +/-   ##
==========================================
+ Coverage   87.11%   87.19%   +0.08%     
==========================================
  Files          66       66              
  Lines       10805    10873      +68     
==========================================
+ Hits         9413     9481      +68     
  Misses       1392     1392              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pamburus pamburus force-pushed the feature/htp branch 2 times, most recently from b782cee to 8017705 Compare January 10, 2026 13:51
@pamburus pamburus marked this pull request as ready for review January 10, 2026 13:58
@pamburus pamburus merged commit 0ff8ba2 into master Jan 10, 2026
13 checks passed
@pamburus pamburus deleted the feature/htp branch January 10, 2026 13:59
@pamburus pamburus added dependencies Pull requests that update a dependency file rust Pull requests that update rust code labels Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant