时区设置为 GMT +1100 至
config.time_zone = 'Australia/Sydney'
日期助手设置为日历
Wice::Defaults::HELPER_STYLE = :calendar
当我通过输入开始日期“2014-10-21”和结束日期“2014-10-21”来过滤日期时间字段“created_at”时,预期的查询应该是
where created_at >= '2014-10-20 13:00:00' and created_at < '2014-10-21 13:00:00'
但实际上生成的sql是
where created_at >= '2014-10-21' and created_at < '2014-10-22'
查看源代码后,我在文件“lib/wice/columns/column_datetime.rb”的第 112 行中找到了以下代码
conditions << opts[:fr].to_date
如果我删除“to_date”,查询将正确生成。
此“to_date”转换的目的是什么以及如何解决此问题?
最佳答案
有什么意见吗?我很长一段时间都没有这个想法。
关于mysql - Ruby on Rails 4 : Unexpected result when filter datetime field in specified time zone with wice_grid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26520397/