我有以下情况。用户从 Rails 的日期和时间选择框中输入日期和时间,在控制器中,方法 create,我有以下参数:
"event"=>
{"title"=>"tet",
"start_date(1i)"=>"2013",
"start_date(2i)"=>"4",
"start_date(3i)"=>"26",
"end_date(1i)"=>"2013",
"end_date(2i)"=>"4",
"end_date(3i)"=>"31",
"start_time(1i)"=>"2013",
"start_time(2i)"=>"4",
"start_time(3i)"=>"26",
"start_time(4i)"=>"10",
"start_time(5i)"=>"05",
"end_time(1i)"=>"2013",
"end_time(2i)"=>"4",
"end_time(3i)"=>"26",
"end_time(4i)"=>"10",
"end_time(5i)"=>"05"}
如果我做
@event = Event.new(params[:event])
输出是
=> #<Event id: nil, start_date: "2013-04-26", title: "tet", created_at: nil, updated_at: nil, owner_id: 0, owner_type: "", archived: false, end_date: "2013-05-01", start_time: "2013-04-26 10:05:00", end_time: "2013-04-26 10:05:00">
end_date 与 params 中的不一样
时区
返回
=> (GMT+02:00) 耶路撒冷
为什么会这样?