#pragma once
#include <cstdint>
#include <optional>
#include <string>
namespace torlinkc {
// Parses a date string into unix seconds, matching what JS's `new
// Date(s).getTime()` / `Date.parse(s)` accept in this codebase: ISO 8601
// ("2024-01-15T00:00:00Z", as bittorrented/subsplease's JSON APIs send) or
// an RFC 822/1123 date (as RSS <pubDate> elements send). libcurl's
// curl_getdate() handles the latter but not the former, so ISO 8601 is tried
// first with its own parser, falling back to curl_getdate.
std::optional<std::int64_t> parseDateToUnixSeconds(const std::string& s);
} // namespace torlinkc