问题描述
真的有必要允许用户从PHP的timezone_identifiers_list()返回的任何时区中选择?有大量的时区,由于有多少个选项,HTML下拉菜单在某些系统上相当滞后。我明白,我可以手工生成普通的美国时区,如太平洋,东部,中部等。但是有没有一个常用的国际时区的列表?通常情况下,我的意思是如果我使用该列表,那么它将占据我国际用户群的99.9%。看起来似乎是过分的,必须将每个可能的时区作为用户的选项。有没有人有关于时区的最佳做法的想法?
Is it really necessary to allow the user to pick from any timezone returned by PHP's timezone_identifiers_list()? There are a tremendous amount of timezones, and that HTML dropdown menu is pretty laggy on some systems due to how many options there are. I understand that I can generate common US timezones by hand such as Pacific, Eastern, Central, etc.. but is there a list of commonly-used international timezones? By common, I mean where if I were to use that list, then it would capture 99.9% of my international user base. It just seems like overkill to have to include EVERY possible timezone as an option to the user. Does anyone have ideas on best practices for timezones in general?
推荐答案
你可以用很多不同的方法来做。
我会说的一个工作最好的只是我们PHP的 timezone_identifiers_list()
。
但是,不要制作一个下拉列表,而是进行两个下拉列表。
You can do it in a lot of different ways.
The one I would say works out the best is just us the PHP's timezone_identifiers_list()
.
But instead of making a dropdown list, make two dropdowns.
- 下拉式应包含区域(欧洲,亚洲,印度等)
- 下拉菜单应该包含选择区域的城市。
然后,您应该与城市下拉列表一个可搜索的字段,所以一个人可以写一些城市名称只显示城市,包括该人写的内容。 ()
这样你将涵盖所有的时区,并不是一个完整的混乱。
And then you should makethe dropdown with the cities a searchable field, so a person can write some of the cityname and it only shows the cities including what the person has written. (as @dam660 suggested Chosen is a good choice here)
This way you would cover all the timezones and it wouldn't be a total mess to look at.
这篇关于什么是向用户呈现可选时区的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!