Add Phoenix.HTML.Safe to Duration#463
Conversation
|
The minimum supported Elixir version is 1.7 at the moment Line 12 in c11a9e3 which does not know anything about Duration, so we might need to conditionally define this? @josevalim |
Good spot! If the decision is to add |
|
I am almost sure that previous Elixir versions did not complain if you implemented a protocol for a module/struct that was not available. But this has changed on v1.18 or 1.19 because of the type system. Let's see what CI says. |
|
@joshua-bouv yeah, you will need to wrap both the definition and the tests in |
|
Done 👍 |
|
💚 💙 💜 💛 ❤️ |
I was creating a form which had a set of options, the values being durations
Durationhasto_iso8601andfrom_iso8601functions so I assumed this would work likeDateandTimedoes (auto converts to ISO), butPhoenix.HTML.Safehadn't been implemented for Duration causing this error:protocol Phoenix.HTML.Safe not implemented for type Duration (a struct).This PR adds the
Phoenix.HTML.Safeimplentation. Their might of been a reason why this wasn't added originally though, but im not too sure why that could be?