rdf-ex/lib/rdf/xsd/utils/date_time.ex
Marcel Otto 5819eec0cf Re-integrate XSD.ex
It turned out that the costs of separating the XSD datatypes are too high
and probably not worth the effort, since with its limited scope
probably nobody would want to use XSD.ex outside of the RDF.ex context
anyway.
2020-05-05 23:58:44 +02:00

18 lines
339 B
Elixir

defmodule RDF.XSD.Utils.DateTime do
@moduledoc false
@spec tz(String.t()) :: String.t()
def tz(string) do
case Regex.run(~r/([+-])(\d\d:\d\d)/, string) do
[_, sign, zone] ->
sign <> zone
_ ->
if String.ends_with?(string, "Z") do
"Z"
else
""
end
end
end
end