我一直在做使用Calendar
一切日期时间的转换是为过去4个月工作正常,但所有的突然我开始在这一些奇怪的行为, 什么我做的是%Calendar.AmbiguousDateTime {possible_date_times日历药剂
1..total_days |> Enum.reduce(start_date, fn _i, acc ->
day_of_week = acc |> Calendar.Date.day_of_week_name
rec_head = get_head_tail(schedule[day_of_week])
rec_head |> Enum.each(fn(x) ->
iterate(x, acc, timezone) |> t_download(interval, t_agent)
end)
acc |> Calendar.DateTime.to_erl |> IO.inspect |> Calendar.DateTime.from_erl!(timezone, {123456, 6}) |> IO.inspect |> Calendar.DateTime.add!(86400)
end)
而且
acc |> Calendar.DateTime.to_erl |> IO.inspect |> Calendar.DateTime.from_erl!(timezone, {123456, 6}) |> IO.inspect |> Calendar.DateTime.add!(86400)
给输出
{{2016, 10, 27}, {1, 0, 0}}
%Calendar.DateTime{abbr: "IST", day: 27, hour: 1, min: 0, month: 10, sec: 0,
std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0,
year: 2016}
{{2016, 10, 28}, {1, 0, 0}}
%Calendar.DateTime{abbr: "IST", day: 28, hour: 1, min: 0, month: 10, sec: 0,
std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0,
year: 2016}
{{2016, 10, 29}, {1, 0, 0}}
%Calendar.DateTime{abbr: "IST", day: 29, hour: 1, min: 0, month: 10, sec: 0,
std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0,
year: 2016}
{{2016, 10, 30}, {1, 0, 0}}
但在最后的日期和时间,而不是给我的,因为它是上面给出正确的输出,这是给这个
{:ambiguous, %Calendar.AmbiguousDateTime{possible_date_times: [%Calendar.DateTime{abbr: "GMT", day: 30, hour: 1, min: 0, month: 10, sec: 0, std_off: 0, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0, year: 2016}, %Calendar.DateTime{abbr: "IST", day: 30, hour: 1, min: 0, month: 10, sec: 0, std_off: 3600, timezone: "Europe/Dublin", usec: {123456, 6}, utc_off: 0, year: 2016}]}}
我完全不知道的这个原因,因为这是工作正常,但所有的突发其给我这些错误。任何帮助?
更新:正在使用https://github.com/lau/calendar日历。
我假设你正在使用[lau/calendar](https://github.com/lau/calendar),可能值得在问题中指出。 – nietaki
谢谢你这样做.. – ijunaidfarooq
@nietaki Btw刚刚看到你是来自MainFrame,我的X同事同事也在Mainframe,Milos Mosic .. – ijunaidfarooq