简体   繁体   English

jQuery Mobile DateBox日历日期1906年7月

[英]JQuery Mobile DateBox calendar date July 1906

For some reason when I load the Calendar it's opening on date ... July 1906 由于某些原因,当我加载日历时,日历的日期是1906年7月。

Here is the code: 这是代码:

var thisTheme = o.pickPageButtonTheme;

var fd=1+self.theDate.getMonth() +'/'+ today+'/'+self.theDate.getFullYear();

if ( ( today === highlightDay || today === presetDay || dates.contains(fd) ) ) { thisTheme = o.pickPageHighButtonTheme; }




                            $('<div><a href="view-paginated.php#&ui-page=Event-Date--2011-01-31-0">' + today + '</a></div>')

                                .addClass('ui-datebox-griddate ui-corner-all ui-btn-up-'+thisTheme)
                                .attr('data-date', today)
                                .appendTo(thisRow)
                                .click(function(e) {
                                    e.preventDefault();
                                    self.theDate.setDate($(this).attr('data-date'));
                                    self.input.val(self._formatDate(self.theDate));
                                    self.close();
                                    self.input.trigger('change');
                                }).hover(
                                    function() { $(this).addClass('ui-btn-down-'+thisTheme).removeClass('ui-btn-up-'+thisTheme); },
                                    function() { $(this).addClass('ui-btn-up-'+thisTheme).removeClass('ui-btn-down-'+thisTheme); }
                                );
                            today++;
                        }
                    }

And the other part of the code is here: 代码的另一部分在这里:

 <input value="1-1-2011" name="date" type="date" data-role="datebox" id="date" data-theme="a" data-options='{"mode": "calbox", "pickPageTheme": "a", "pickPageHighButtonTheme": "e", "setDateButtonLabel": "Calendar"}'/>

It seems to be related to the FormatDate. 它似乎与FormatDate有关。

How can I change this please? 我该如何更改?

Thanks 谢谢

Well, why it picked 1906 is beyond me - but you arbitrarily picked a date format, you'll need to let datebox know about it before it will pick it up. 嗯,为什么选择1906年的内容超出了我的范围-但您随意选择了一种日期格式,则需要在获取日期框之前先通知它。 Give something like this a shot and see if it works: 试一下这样的镜头,看看是否有效:

<input value="1-1-2011" ... data-options='{"dateFormat":"mm-dd-YYYY", "mode": "calbox", "pickPageTheme": "a", "pickPageHighButtonTheme": "e", "setDateButtonLabel": "Calendar"}'/>

dateFormat takes the following: dateFormat需要以下内容:

  • YYYY : 4 Digit Year YYYY :4位数字的年份
  • MM : 2 Digit Month (zero pad) MM :2位数月(零填充)
  • mm : 1 or 2 Digit Month mm :1或2位数月
  • DD : 2 Digit Day (zero pad) DD :2位数字天(零填充)
  • dd : 1 or 2 Digit Day dd :1或2位数字天

Additionally, DateBox has had some pretty serious modifications done to how it detects dates, but please let me know if it persists, I'll try to duplicate and correct it. 此外,DateBox在检测日期方面进行了一些相当认真的修改,但是请告诉我它是否仍然存在,我将尝试复制并更正它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM