module
JosieHealth::Utils::Timestamp
Defined in:
timestamp.crClass Method Summary
-
.format_display(rfc3339 : String) : String
Format RFC3339 timestamp for display Shows time only if today, otherwise shows date and time
-
.now_rfc3339 : String
Get current time as RFC3339
-
.parse_ago(ago_str : String) : Time | Nil
Parse HHMM format (e.g., "0130" = 1 hour 30 minutes ago) to Time Supports formats: HHMM, HMM, MM (pads with zeros) Returns nil if invalid format or out of range
-
.parse_ago_rfc3339(ago_str : String) : String
Parse HHMM format to RFC3339 string Returns current time as RFC3339 if parsing fails
-
.parse_timestamp(ts : String) : String | Nil
Parse various timestamp formats to RFC3339 Supports: - Full ISO: 2025-01-15T14:30:00 or 2025-01-15T14:30 - Time with colon: HH:MM (assumes today) - Time without colon: HHMM (assumes today) Returns nil if invalid format
Class Method Detail
Format RFC3339 timestamp for display Shows time only if today, otherwise shows date and time
Parse HHMM format (e.g., "0130" = 1 hour 30 minutes ago) to Time Supports formats: HHMM, HMM, MM (pads with zeros) Returns nil if invalid format or out of range
Parse HHMM format to RFC3339 string Returns current time as RFC3339 if parsing fails
Parse various timestamp formats to RFC3339 Supports:
- Full ISO: 2025-01-15T14:30:00 or 2025-01-15T14:30
- Time with colon: HH:MM (assumes today)
- Time without colon: HHMM (assumes today) Returns nil if invalid format