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.
18 lines
339 B
Elixir
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
|