I haven’t dealt with dates yet but I’m gonna assume you’re using this package.
The issue here is that you’re using Date
(type) as a value. I highly recommend reading more about Elm’s types, and the differences between type constructors and data constructors for union types.
One way you can obtain the date is to pass it as an input argument from JS, as shown here.
You can also use Date.today
function from the same package to perform a task in the init
function, as seen here.
Conclusion: obtaining the date/time is an async operation (AKA side effect), and Elm, being a purely functional language, deals with them using the commands.