Date type not recognized

200 views
Skip to first unread message

Casper Bollen

unread,
Jun 27, 2017, 9:00:30 AM6/27/17
to Elm Discuss
When I want to use the Date type, it isn't recognized. Isn't this type automatically loaded with the core libs??

Casper Bollen

unread,
Jun 27, 2017, 9:03:54 AM6/27/17
to Elm Discuss
For example when I use:

type alias Test = { date : Date }

I get an Cannot find type Date error

Ilias Van Peer

unread,
Jun 27, 2017, 9:49:26 AM6/27/17
to Elm Discuss
Hi Casper,

Correct, the `Date` module (and type) are not imported or exposed by default. You can find the default imports here: http://package.elm-lang.org/packages/elm-lang/core/latest

To make `Date` available in your module, you can use `import Date exposing (Date)`. The "exposing" part means you can reference the `Date` type unqualified as `Date` rather than `Date.Date`, but other functions will only be available when qualified (e.g. `Date.fromString`)

Good luck!

Op dinsdag 27 juni 2017 15:03:54 UTC+2 schreef Casper Bollen:
Reply all
Reply to author
Forward
0 new messages