开发者

JQuery Mobile DateBox calendar date July 1906

For some reason when I load the Calendar it's opening on date ... July 1906

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.the开发者_StackOverflow社区Date.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.

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. 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:

  • YYYY : 4 Digit Year
  • MM : 2 Digit Month (zero pad)
  • mm : 1 or 2 Digit Month
  • DD : 2 Digit Day (zero pad)
  • dd : 1 or 2 Digit Day

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜