-module(aws@internal@datetime).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/aws/internal/datetime.gleam").
-export([parse_iso8601/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Small helpers for the timestamp formats AWS uses in metadata responses.\n"
" Implementation lives in `aws_ffi.erl` so we can lean on Erlang's\n"
" `calendar` module rather than reimplementing gregorian-seconds arithmetic\n"
" in Gleam.\n"
).
-file("src/aws/internal/datetime.gleam", 11).
?DOC(
" Parse an AWS-style ISO 8601 UTC timestamp into unix seconds.\n"
"\n"
" Accepts both `\"2023-11-30T15:30:00Z\"` and the millisecond-fractional\n"
" variant `\"2023-11-30T15:30:00.000Z\"`. Any other shape returns `Error(Nil)`.\n"
).
-spec parse_iso8601(binary()) -> {ok, integer()} | {error, nil}.
parse_iso8601(Timestamp) ->
aws_ffi:parse_iso8601(Timestamp).