jQuery 日期/时间选择器
我一直在寻找一个像样的 jQuery 插件,可以处理日期和时间。 核心 UI DatePicker
很棒,但不幸的是我也需要花时间。
我发现了一些让 DatePicker 与时间一起工作的技巧,但它们看起来都很不优雅,谷歌也没有发现任何好的东西。
是否有一个好的 jQuery 插件可以在具有可用界面的单个 UI 控件中选择日期和时间?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
只是为了在这里添加信息,Fluid Project 有一篇很好的 wiki 文章,概述了大量日期和/或时间选择器 此处。
Just to add to the info here, The Fluid Project has a nice wiki write-up overviewing a large number of date and/or time pickers here.
我最近对此进行了研究,但尚未找到一个像样的日期选择器,其中还包括一个像样的时间选择器。 我最终使用的是 eyecon 很棒的 DatePicker,有两个简单的时间下拉菜单。 我很想使用 Timepickr.js 不过,看起来非常不错方法。
I researched this just recently and have yet to find a decent date picker that also includes a decent time picker. What I ended up using was eyecon's awesome DatePicker, with two simple dropdowns for time. I was tempted to use Timepickr.js though, looks like a really nice approach.
我遇到了同样的问题。 我实际上是使用服务器端编程开发的,但我进行了快速搜索以尝试帮助您并找到了这个。
看起来还不错,没有太多看源代码,但似乎是纯粹的 JavaScript。
看一下:
http://www.rainforestnet.com/datetimepicker/datetimepicker.htm
这是演示页面链接:
http://www.rainforestnet.com/datetimepicker/datetimepicker -demo.htm
祝你好运
I have ran into that same problem. I actually developed my using server side programming, but I did a quick search to try and help you out and found this.
Seems alright, didn't look at the source too much, but seems to be purely JavaScript.
Take look:
http://www.rainforestnet.com/datetimepicker/datetimepicker.htm
Here is the demo page link:
http://www.rainforestnet.com/datetimepicker/datetimepicker-demo.htm
good luck
这是我用来让用户选择一个的代码
datetimepicker,设置日期时间,并有
其他日期时间选择器向该时间添加一分钟。
我需要这个来进行定制药物控制......
无论如何,我认为它可能会帮助其他人,因为我可以
在网上找不到答案...
(至少不是完整的答案)
请记住,添加的 60000 会增加一分钟。
(60 * 1000 毫秒)
This is some code I use to have a user select one
datetimepicker, set the datetime, and have the
other datetimepicker add One Minute to that time.
I needed this for a custom medication control....
Anyway, thought it might help someone else since I could
not find the answer any where online...
(at least not a complete answer)
Keep in mind that the 60000 added, adds one minute.
(60 * 1000 milliseconds)
看看下面的 JavaScript 插件。
带有日期和时间的 Javascript 日历
我已使其尽可能简单。 但它仍处于早期阶段。
让我知道反馈,以便我可以改进它。
Take a look at the following JavaScript plugin.
Javascript Calendar with date and time
I've made it to be simple as possible. but it still in its early days.
Let me know the feedback so I could improve it.
不是 jQuery,但它非常适合带有时间的日历:JavaScript 日期时间选择器< /em>.
我只是绑定了点击事件来弹出它:
Not jQuery, but it works well for a calendar with time: JavaScript Date Time Picker.
I just bound the click event to pop it up:
我做了一个这样的函数:
然后我像这样使用 jQuery UI 日期选择器:
所以,我得到这样的值: 2010-10-31 12:41:57
I make one function like this:
Then I use the jQuery UI datepicker like this:
So, I get the value like this: 2010-10-31 12:41:57
我们很难找到一个能按照我们想要的方式工作的方法,所以我写了一个。 我维护源代码并修复出现的错误并提供免费支持。
http://www.yart。 com.au/Resources/Programming/ASP-NET-JQuery-Date-Time-Control.aspx
We had trouble finding one that worked the way we wanted it to so I wrote one. I maintain the source and fix bugs as they arise plus provide free support.
http://www.yart.com.au/Resources/Programming/ASP-NET-JQuery-Date-Time-Control.aspx
到目前为止,最好、最简单的日期时间选择器选项是 http://trentrichardson.com/examples/timepicker/ 。
它是 jQuery UI Datepicker 的扩展,因此它也支持相同的主题,并且工作方式非常相同,语法相似等。在我看来,这应该与 jQuery UI 打包在一起。
By far the nicest and simplest DateTime picker option is http://trentrichardson.com/examples/timepicker/.
It is an extension of the jQuery UI Datepicker so it will support the same themes as well it works very much the same way, similar syntax, etc. This should be packaged with the jQuery UI imo.
@David,感谢您的推荐! @fluid_chelsea,我刚刚发布了 Any+Time(TM) 版本 3.x,它使用 jQuery 而不是 Prototype,并且具有大大改进的界面,所以我希望它现在满足您的需求:
http://www.ama3.com/anytime/
如有任何问题,请通过我网站上的评论链接告诉我!
@David, thanks for the recommendation! @fluid_chelsea, I've just released Any+Time(TM) version 3.x which uses jQuery instead of Prototype and has a much-improved interface, so I hope it now meets your needs:
http://www.ama3.com/anytime/
Any problems, please let me know via the comment link on my website!
在我看来,日期和时间应作为两个单独的输入框处理,以便用户输入最有用且最高效。 让用户一次输入一件事是一个很好的原则,恕我直言。
我使用核心 UI DatePicker 和以下时间选择器。
这个的灵感来自于 Google 日历使用的一个:
jQuery timePicker:
示例: http://labs.perifer.se/timedatepicker/
github上的项目: https://github.com/perifer/timePicker
我发现它是最好的在所有替代方案中。 用户可以快速输入,它看起来干净、简单,并且允许用户输入精确到分钟的特定时间。
附:
在我看来:滑块(由一些替代时间选择器使用)需要过多的点击,并且需要用户的鼠标精度(这使得输入速度变慢)。
In my view, dates and times should be handled as two separate input boxes for it to be most usable and efficient for the user to input. Let the user input one thing at a time is a good principle, imho.
I use the core UI DatePicker, and the following time picker.
This one is inspired by the one Google Calendar uses:
jQuery timePicker:
examples: http://labs.perifer.se/timedatepicker/
project on github: https://github.com/perifer/timePicker
I found it to be the best among all of the alternatives. User can input fast, it looks clean, is simple, and allows user to input specific times down to the minute.
PS:
In my view: sliders (used by some alternative time pickers) take too many clicks and require mouse precision from the user (which makes input slower).
我对日期选择器的最佳体验是基于原型的 AnyTime。 我知道这不是 jQuery,但它可能仍然值得您做出妥协。 我完全不知道原型,但它仍然很容易使用。
我发现一个警告:它在某些浏览器上不向前兼容。 也就是说,它不适用于 Chrome 上较新版本的原型。
My best experience with a datepicker is with the prototype-based AnyTime. I know that's not jQuery, but it may still be worth the compromise for you. I know absolutely no prototype, and it's still easy enough to work with.
One caveat I've found: it is not forward compatible on some browsers. That is, it did not work with a newer version of prototype on Chrome.