I am using jQuery date picker to display the calendar all over my app. I want to know if I can use it to display the month and year (May 2010) and not the calendar?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
This will solve the problem =) But I wanted the timeFormat yyyy-mm
Only tried in FF4 though
Made a couple of refinements to BrianS's nearly perfect response above:
I've regexed the value set on show because I think it does actually make it slightly more readable in this case (although note I'm using a slightly different format)
My client wanted no calendar so I've added an on show / hide class addition to do that without affecting any other datepickers. The removal of the class is on a timer to avoid the table flashing back up as the datepicker fades out, which seems to be very noticeable in IE.
EDIT: One problem left to solve with this is that there is no way to empty the datepicker - clear the field and click away and it repopulates with the selected date.
EDIT2: I have not managed to solve this nicely (i.e. without adding a separate Clear button next to the input), so ended up just using this: https://github.com/thebrowser/jquery.ui.monthpicker - if anyone can get the standard UI one to do it that would be amazing.
You also need this style rule:
I combined many of above good answers and arrive on this:
This is proved working but facing many bugs so I was forced to patch in several places of datepicker:
patch1: in _showDatepicker : to smooth the hide;
patch2: in _checkOffset: to correct month picker positioning (otherwise when the field is at the bottom of the browser, the offset check is off);
patch3: in onClose of _hideDatepicker: otherwise when closing the date fields will flash for a very short period which is very annoying.
I know the my fix was far from good but for now it's working. Hope it helps.
Is it just me or is this not working as it should in IE(8)? The date changes when clicking done, but the datepicker opens up again, until you actually click somewhere in the page to loose focus on the input field...
I'm looking in to solving this.
This code is working flawlessly to me:
Output is:
I've had certain difficulties with the accepted answer and no other one could be used with a minimum effort as a base. So, I decided to tweak the latest version of the accepted answer until it satisfies at least minimum JS coding/reusability standards.
Here is a way much cleaner solution than the 3rd (latest) edition of the Ben Koehler's accepted answer. Moreover, it will:
mm/yy
format, but with any other including the OP'sMM yy
.datestr
,month
,year
etc variables.Check it out:
And everything else you need is the following CSS somewhere around:
That's it. Hope the above will save some time for further readers.