こんにちは私はエルムの新作です。現在の時間を取得し、それをエルムの日付に変換することにいくつかの問題があります。Convert Time.now to Date - Elm
メッセージタイプ - メッセージとモデルに新しいメッセージを追加する機能があります。私はメッセージとテキストとユーザーIDと共に投稿された時間を保存しようとしています。
私はこのエラーを取得しておくしかし -
The argument to function `fromTime` is causing a mismatch.
59| Date.fromTime (currentTime Time.now)
^^^^^^^^^^^^^^^^^^^^
Function `fromTime` is expecting the argument to be:
Time
But it is:
x -> Time -> Time
Hint: It looks like a function needs 2 more arguments.
ここでは、コード
type alias Message =
{ text : String,
date : Date,
userId : Int
}
currentTime : task -> x -> Time -> Time
currentTime _ _ time =
time
newMessage : String -> Int -> Message
newMessage message id =
{ text = message
, date = Date.fromTime (currentTime Time.now)
, userId = id
}
は、私は本当に何が起こっているかを把握することはできませんです。どんな助けでも大歓迎です。ありがとう。
良い説明!どうもありがとう。 –