Skip to main content

parse_date_to_git_timestamp

Function parse_date_to_git_timestamp 

Source
pub fn parse_date_to_git_timestamp(date_str: &str) -> Option<String>
Expand description

Normalise a date string into Git’s stored <epoch> <offset> timestamp.

Accepts the forms Git’s commit/--date path understands: RFC 3339 / ISO 8601 (with or without an explicit zone, in which case UTC is assumed), YYYY-MM-DD HH:MM:SS <tz>, @<epoch> <tz>, and the looser approxidate-style strings handled by parse_date. Returns None when the input is already in <epoch> <offset> form (nothing to convert) or cannot be parsed; callers then fall back to using the raw string.