Helper class for formatting recorded_at timestamps as relative time.
More...
#include <RelativeTimeHelper.hpp>
|
| static QString | format (const std::string &recorded_at) |
| | Formats a recorded_at timestamp string as relative time.
|
| |
| static QString | format (const QString &recorded_at) |
| | Formats a recorded_at QString as relative time.
|
| |
| static QString | format (const std::chrono::system_clock::time_point &recorded_at) |
| | Formats a time_point as relative time.
|
| |
Helper class for formatting recorded_at timestamps as relative time.
Provides convenience functions to convert ISO date/time strings to human-readable relative time strings like "5 minutes ago" or "yesterday".
◆ format() [1/3]
| QString format |
( |
const std::string & |
recorded_at | ) |
|
|
static |
Formats a recorded_at timestamp string as relative time.
Supports multiple input formats:
- ISO 8601: "2025-01-15T10:30:00"
- Date + time: "2025-01-15 10:30:00"
- Date only: "2025-01-15"
- Parameters
-
| recorded_at | The timestamp string to format. |
- Returns
- Relative time string (e.g., "5 minutes ago", "yesterday"), or the original string if parsing fails.
◆ format() [2/3]
| QString format |
( |
const QString & |
recorded_at | ) |
|
|
static |
Formats a recorded_at QString as relative time.
- Parameters
-
| recorded_at | The timestamp string to format. |
- Returns
- Relative time string or the original string if parsing fails.
◆ format() [3/3]
| QString format |
( |
const std::chrono::system_clock::time_point & |
recorded_at | ) |
|
|
static |
Formats a time_point as relative time.
- Parameters
-
| recorded_at | The time point to format. |
- Returns
- Relative time string (e.g., "5 minutes ago", "yesterday").