Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-3829

Change calendar.js to support future dates.

    XMLWordPrintable

    Details

      Description

      Something like this:

      function showCalendar(obj, yearsPrevious) {
      	// if the object doesn't have an id, just set it to some random text so jq can use it
      	if(!obj.id) {
      		obj.id = "something_random" + (Math.random()*1000);
      	}
      	
      	//set appendText to something so it doesn't automagically pop into the page
      	var opts = { appendText: " " };
      	if (yearsPrevious && yearsPrevious>0)
      		opts["yearRange"] = "-" + yearsPrevious + ":+0";
      	else
      		opts["yearRange"] = "-0:+"+-1*yearsPrevious;
      
      	alert(opts["yearRange"]);
      	var dp = new DatePicker(jsDateFormat, obj.id, opts);
      	jQuery.datepicker.setDefaults(jQuery.datepicker.regional[jsLocale]);
      	
      	obj.onclick = null;
      	dp.show();
      	return false;
      }
      

      (in this change you can send a negative number of previousYears to allow future years)

      A better way to add another function that gets obj,previousYears,futureYears.

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              bhashitha Bhashitha Wijewardhane
              Reporter:
              yony258 Yonatan Grinberg
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 15 minutes
                  15m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 15 minutes
                  15m