Rails 日期/时间选择器(希望是 jquery)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1891633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rails date/time picker (hopefully jquery)
提问by riley
Looking for a date and datetime picker that will integrate fairly seamlessly with Rails. I'm sure some people must be using something similar. I have tried
寻找将与 Rails 无缝集成的日期和日期时间选择器。我相信有些人一定在使用类似的东西。我试过了
the unobtrusive date picker plugin but it breaks with the latest release of Rails.
calendar date select plugin uses prototype which I have removed from my app and don't want to add back.
active calendar plugin - broken with latest Rails and hacked to fix but doesn't fill out the text fields when a model is loaded.
不显眼的日期选择器插件,但它在最新版本的 Rails 中崩溃了。
日历日期选择插件使用我已从我的应用程序中删除并且不想添加回来的原型。
活动日历插件 - 被最新的 Rails 破坏并被黑客修复,但在加载模型时不填写文本字段。
Thanks very much.
非常感谢。
回答by liangzan
http://trentrichardson.com/examples/timepicker/
http://trentrichardson.com/examples/timepicker/
This is the best date time picker I've seen. milesich
is not actively maintained anymore, and has bugs if the input field is blank. Sure there are solutions (in the comments), but if you look at the code, its one ugly hack.
这是我见过的最好的日期时间选择器。milesich
不再积极维护,如果输入字段为空,则会出现错误。当然有解决方案(在评论中),但如果你看一下代码,它是一个丑陋的黑客。
Trent's implementation is much cleaner. Shorter, easy to understand and minimal CSS to add. I highly recommend his work.
Trent 的实现要简洁得多。更短、更容易理解并且添加的 CSS 最少。我强烈推荐他的作品。
回答by RSolberg
Here is a good write up on one option.
这是一个关于一个选项的好文章。
http://milesich.com/timepicker/
http://milesich.com/timepicker/
(source: milesich.com)
(来源:milesich.com)
There is another post here on StackOverflow on a similar topic. You are looking for something more specific to rails than the OP of this one, but it still has some good info.
StackOverflow 上还有一篇关于类似主题的帖子。您正在寻找的东西更具体的轨道比这个的OP一个,但它仍然有一些好的信息。
回答by Andrew M. Andrews III
The Any+Time(TM) Datepicker/Timepicker AJAX Calendar Widgetuses jQuery and should work seamlessly with Rails. It provides many date/time formatting options and requires only a single line of your own JS code to attach to any text field. It also aims to minimize the number of mouse clicks necessary to select a date and/or time, and provides WAI-ARIA keyboard accessibility for users without a mouse. Did I mention Time Zone support and custom Styles/Themes using CSS and/or jQuery UI? :-)
在任何时间+(TM)日期选择器/ Timepicker AJAX日历控件使用jQuery和应该使用Rails无缝协作。它提供了许多日期/时间格式选项,并且只需要一行您自己的 JS 代码即可附加到任何文本字段。它还旨在最大限度地减少选择日期和/或时间所需的鼠标点击次数,并为没有鼠标的用户提供 WAI-ARIA 键盘可访问性。我是否提到了使用 CSS 和/或 jQuery UI 的时区支持和自定义样式/主题?:-)