寻找 js(也许是 jQuery)时区(仅)控制 UI 小部件

发布于 2024-11-08 15:09:36 字数 689 浏览 0 评论 0 原文

我一直在寻找一个 javascript(希望是 jQuery)时区选择器/选择器/控制小部件,我可以将其包含在我的社交日历/事件路由器网络应用程序中。

鉴于通常的下拉菜单中列出了大约 400 个城市,我希望有人会怜悯这个可怜的用户,并在我自己创建一个之前提供一个具有更好界面的漂亮 UI 小部件。 (我见过一些不错的网站示例,它们使用地图来允许选择时区,但它们在我的应用程序页面上占用了太多空间。)

虽然有多种方法可以列出时区,而不仅仅是按 GMT offset,我认为组织时区的最佳方法是使用带有子菜单的分层下拉菜单。然后,我将按大陆列出,然后列出子菜单以列出国家和主要城市,也许还列出不遵循地理或夏令时规则的城市/地区例外情况。即亚利桑那州采用 MST,印第安纳州的一些城市采用 CST。

小部件中包含记住用户最后 5 个选择并将其显示在列表顶部的功能。

该小部件还允许用户使用自动建议进行键入(它将把用户输入视为前缀、后缀以及查询中的任何其他位置。这在 SQL 术语中相当于:WHERE some_column_name LIKE %query%)。他们的打字会提供一组减少的选择,从而使可供选择的列表变得更短。 ie- CST 将显示使用 CST 作为缩写的几个时区,-7 将显示当前时区设置为 GMT-7 的城市列表,5.5 将列出 Inida 的国家/地区等。

如果有人知道一个小部件接近匹配这个,会很好奇他们从哪里获取时区和夏令时数据,因为有多个来源并且数据总是在更新。

I have been looking for a javascript (hopefully jQuery) timezone chooser/picker/control widget that I can include in my social-calendar/event-router web app.

Given that there are approximately 400 cities listed in the usual dropdown menus, I was hoping that someone had taken pity on the poor user and had come with a nice UI widget with a better interface before I create one myself. (I have seen some nice web site examples that use a map to allow for a time zone choice, but they take up too much real estate on the page for my app.)

While there are several ways to list timezones other than just by GMT offset, I think that the best way to organize timezones is to use a hierarchical dropdown menu with sub menus. Then I would list by continent, then sub-menus to list both country and major cities and perhaps city/region exceptions that don't follow the geographical or daylight savings time rule. i.e Arizona in MST and some cities in Indiana in CST.

Included in the widget would be the ability to remember the user's last 5 choices and present these at the top of the list.

The widget would also allow the user to type using autosuggest (which will consider the user input as a prefix, suffix and at any other location in the query. which in SQL terms is an equivalent to saying: WHERE some_column_name LIKE %query%). Their typing would present a reduced set of choices making the list to choose from much shorter. i.e.- CST would present the several timezones that use CST as their abbreviation, -7 would present a list of cities that had their current timezone set to GMT-7, 5.5 would list the country of Inida, etc.

If someone knows of a widget that comes close to matching this, would be curious know where they are getting their timezone and DST data, since there are several sources and the data is always being updated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

惟欲睡 2024-11-15 15:09:36

我认为 timepicker 的 github 上有一个有用的开发分支,带有时区 这里< /a>.

至于有限的输入集,我真的很喜欢 timepickr,但它仍然需要一个时区。我不确定您打算如何将此字段提交到数据库,但您可以只为时区设置一个相邻的文本框字段,并将其与 jquery 自动完成 ,这会很好,因为如果您将时区的长时区和缩写放在文本标签中,它们可以过滤掉它们。

使用 jquery autocomplete 来使用有限的选项来滚动您自己的实现也不难。

I think there is a useful dev branch on github of timepicker with timezone here.

As for the limited set of inputs, I really like timepickr, but it still needs a timezone. I'm not sure how you plan to submit this field to the database, but you could just have an adjacent textbox field for the timezone and tie it with jquery autocomplete for the timezones, which would be nice because they could filter off both the long and abbreviation for the timezone if you have them in the text label together.

It also wouldn't be hard to use jquery autocomplete to roll your own implementation with the limited options.

浪推晚风 2024-11-15 15:09:36

我在这里创建了一个 LGPL 的小部件(jQuery 插件): https://github.com/peterjtracey /timezoneWidget - 它具有相应的 PHP 代码,可以动态生成时区数据,以便考虑夏令时并轻松存储服务器端可用的数据库值。

I have created and LGPL'd exactly such a widget (jQuery plugin) here: https://github.com/peterjtracey/timezoneWidget - it has corresponding PHP code that generates the timezone data dynamically so that it takes into account daylight savings and easily stores database values usable server-side.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文