parmarmayur9090 / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Datepicker how to show last three months #302

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'd like to have the datepicker to show the last three months.
I've put the startdate to today 3 months ago.
But it just shows August - August - August.

Look at that site:
http://www.schauenburg.de/index.php?article_id=68

That's the Script:
<script type="text/javascript">
var $j = jQuery.noConflict();
 $j(function()
            {
                // Set the date format to something that is easy for our backend to understand...
                Date.format = 'yyyy-mm-dd';

                // Save a reference to the hidden input form field...
                var $hiddenInput = $j('#selectedDate');

                // initialise the date picker with your chosen settings
                $j('#multimonth').datePickerMultiMonth(
                    {
startDate: '2011-06-16',
                endDate: (new Date()).asString(),
                        numMonths: 3,
                        inline: true,
                        showCurrentAtPos: 1,
                    }
                ).dpmmSetSelected( // initialise with the value from the hidden field 
                    $hiddenInput.val()
                ).bind( // when a new date is selected...
                    'dateSelected',
                    function(event, date, $td, status)
                    {
                        // update the hidden field with the selected date...
                        $hiddenInput.val(date.asString());
                        document.forms["chooseDateForm"].submit();
                    }
                );

                // and just for debugging on this page...
                $j('#showHiddenValue').bind(
                    'click',
                    function(e)
                    {
                        alert($hiddenInput.val());
                        return false;
                    }
                );
            });
        </script>

On date selected form is only submitted in Safari but not on Firefox or IE.

I'm glad to read your answers.

Original issue reported on code.google.com by simonteu...@googlemail.com on 16 Aug 2011 at 12:16

GoogleCodeExporter commented 8 years ago
Are you definitely using the most up to date copy of the multimonth plugin [1]?

It seems to work fine on this demo page:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiMonth4
.html

[1] 
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePi
ckerMultiMonth.js

Original comment by kelvin.l...@gmail.com on 16 Aug 2011 at 7:58

GoogleCodeExporter commented 8 years ago
No I'd rather like to show the current month and the two months before. So in 
this case
June July August. 

Original comment by simonteu...@googlemail.com on 19 Aug 2011 at 7:47

GoogleCodeExporter commented 8 years ago
I asked if you were definitely using the latest code...

Also, you call dpmmSetSelected but $hiddenInput.val() is empty. Do you want to 
set the selected date to something or not?

Original comment by kelvin.l...@gmail.com on 19 Aug 2011 at 7:55

GoogleCodeExporter commented 8 years ago
It is the latest versions of all scripts.
$hiddenInput.val() is also set from the very beginning.
Tested it width alert($hiddenInput.val());

???

Original comment by simonteu...@googlemail.com on 19 Aug 2011 at 12:25