# `Feel.Runtime.TemporalText`
[🔗](https://github.com/FeeJai/BDM/blob/feel-v0.1.0/apps/feel/lib/feel/runtime/temporal_text.ex#L1)

Reads the text of a time or a date and time as DMN 1.6 writes it, and as the extensions that are on spell it (D-81).

The functions `time(from)` and `date and time(from)` read their text this way (`Feel.Builtin.Conversion`), and so do
the endpoints of the text of `range(from)` (`Feel.Runtime.RangeText`, D-45).

    iex> env = Feel.Runtime.Env.new()
    iex> Feel.Runtime.TemporalText.read(env, "13:30:00", &Feel.Value.Time.parse/1) |> elem(0)
    :ok
    iex> Feel.Runtime.TemporalText.read(env, "13:30", &Feel.Value.Time.parse/1)
    :error
    iex> env = Feel.Runtime.Env.new(extensions: Feel.Extensions.new([:camunda]))
    iex> {:ok, time, spelled} = Feel.Runtime.TemporalText.read(env, "13:30", &Feel.Value.Time.parse/1)
    iex> {time.hour, Enum.map(Feel.Runtime.Env.diagnostics(spelled), & &1.code)}
    {13, [:temporal_spelling]}

# `read`

```elixir
@spec read(Feel.Runtime.Env.t(), String.t(), Feel.Value.Temporal.Spellings.parser()) ::
  {:ok, Feel.Value.Temporal.t()}
  | {:ok, Feel.Value.Temporal.t(), Feel.Runtime.Env.t()}
  | :error
```

Reads `text` with `parse`, and if that does not read it, as the extensions spell it.

`{:ok, value}` for the text as DMN 1.6 writes it, `{:ok, value, env}` for another spelling, with the `:info`
`:temporal_spelling` reported in `env` (once for a text in a run), and `:error` for a text that nothing reads.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
