-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REQ][Elm] Remove DateTime
in favour of Posix
#3578
Comments
DateTime
in favour of Posix
DateTime
in favour of Posix
What about using |
@wing328 Could work, but isn't really necessary. Because it's a The suggestion is mainly targetted towards avoiding confusion and using the type people know. Thanks for the tipp. |
I could rename the alias to |
I was thinking of dropping the name. Is anything wrong with it or would you subject doing it like this? module DateTime exposing (decoder, encode, toString)
import Iso8601
import Json.Decode as Decode exposing (Decoder)
import Json.Encode as Encode
import Result
import Time exposing (Posix)
decoder : Decoder Posix
decoder =
Decode.string
|> Decode.andThen decodeIsoString
encode : Posix -> Encode.Value
encode =
Encode.string << toString
decodeIsoString : String -> Decoder Posix
decodeIsoString str =
case Iso8601.toTime str of
Result.Ok posix ->
Decode.succeed posix
Result.Err _ ->
Decode.fail <| "Invalid date: " ++ str
toString : Posix -> String
toString =
Iso8601.fromTime |
There are two issues here:
|
In the upcoming 5.0.0 release both |
Is your feature request related to a problem? Please describe.
Generated code is obfuscating
Posix
with a new nameDateTime
.Describe the solution you'd like
DateTime
is an alias forTime.Posix
. SinceTime.Posix
is now being used everywhere in Elm applications, it could make sense to remove thetype alias
for clarification. I think this is a left-over from the code base beforeTime.Posix
was introduced.The text was updated successfully, but these errors were encountered: