Skip to main content

format_date

Function format_date 

Source
pub fn format_date(iso_date: &str) -> String
Expand description

Format an ISO 8601 date string into a human-readable form.

Input format: 2024-01-15T10:30:00Z or similar ISO 8601. Output format: Jan 15, 2024.

If the input cannot be parsed, the original string is returned.

§Examples

use gor::output::format_date;

assert_eq!(format_date("2024-01-15T10:30:00Z"), "Jan 15, 2024");
assert_eq!(format_date("2023-12-25T00:00:00Z"), "Dec 25, 2023");