#pragma once #include #include #include namespace radiantwave::datetime { // Default date format (US convention): MM/DD/YYYY. constexpr const char* DEFAULT_DATE_FORMAT = "%m/%d/%Y"; // One selectable date format. `name` is a human-friendly convention label; // `pattern` is the strftime spec used to render it. struct DateFormatOption { std::string name; std::string pattern; }; // The formats offered to the end user, ordered most-to-least common. std::vector getDateFormatOptions(); // Render `t` in local time using a strftime pattern (e.g. "%m/%d/%Y"). // Falls back to an empty string on error. std::string formatDate(std::time_t t, const std::string& pattern); // Render `t` as a 24-hour clock: HH:MM:SS. std::string formatTime(std::time_t t); // Convert a 24-hour clock `HH:MM` string to a 12-hour display label, e.g. // "00:00" -> "12:00 AM", "13:05" -> "1:05 PM". Storage and parsing remain // 24-hour; this is display-only. Returns `hm24` unchanged when it is not a // valid 24-hour time. std::string formatHm12h(const std::string& hm24); // Render `t` in local time as a 12-hour clock label, e.g. "7:05 PM". std::string formatTime12h(std::time_t t); } // namespace radiantwave::datetime