使用Time.now来获取Elm 0.18中的时区日期

问题描述 投票:0回答:1
posixDateTask : Task.Task x Time.Date.Date
posixDateTask = 
    let
        timeZoneDate now =
            Time.Date.date
                (Time.ZonedDateTime.year (Time.ZonedDateTime.fromDateTime (TimeZones.canada_pacific ()) now))
                (Time.ZonedDateTime.month (Time.ZonedDateTime.fromDateTime (TimeZones.canada_pacific ()) now))
                (Time.ZonedDateTime.day (Time.ZonedDateTime.fromDateTime (TimeZones.canada_pacific ()) now))
    in
    Time.now
        |> Task.map timeZoneDate

这给我一个错误:

    |> Task.map timeZoneDate

(|>) is expecting the right side to be a:

     Task.Task x Time.Time -> a

But the right side is:

    Task.Task x Time.DateTime.DateTime -> Task.Task x Time.Date.Date

我应该如何更改以返回Task.Task x Time.Date.Date类型。我不知道Time.DateTime.DateTime的来源。

time utc elm elm-0.18
1个回答
0
投票
Time.DateTime.fromTimestamp
© www.soinside.com 2019 - 2024. All rights reserved.