J W*_*ezy 5 asp.net asp.net-mvc jquery datepicker jquery-ui-datepicker
如何将年份数组传递到yearRange或年份下拉菜单?
此问题与以下帖子有关: jQuery DatePicker:当date字段为12-31-9999时,currentDate不起作用.解决方案是做2000:c + 1.但是,这里的问题是yearRange是从2000年到9999年.这会导致性能问题,因为需要几秒钟来填充年份下拉列表.此外,2020年至9998年尚未需要.
当日期字段为12-31-9999时,我只希望yearRange显示2000:+ 1和当前年份9999.因此,drop yearRange应提供以下年份:2000 - 2019,9999.
根据https://api.jqueryui.com/datepicker/#option-yearRange - 根据文档,这是不可能的。您只能设置一个连续范围。
But really this issue brings us directly back to the X-Y problem discussed in your earlier question - basically if your end dates were null instead of using a pretend date, you wouldn't have this issue in the first place. And your application's data quality would be better. I already know you don't want to hear that, but that's the root of the problem. If you can't change what's in the database, then at least remove these dates in the UI layer