0 Replies Latest reply on Oct 12, 2007 8:05 PM by Jason Long

    Entering time manually in calendar field

    Jason Long Master

      I need the ability for the user to enter time into the calendar input field.

      If I set datePattern="MM-dd-yy hh:mm a" the value is formatted correctly when the page loads. And as long as the value is formatted this way the value makes it successfuly into my model.

      However if I use the calendar to select the input fields value is replaced and formatted correctly except that hh:mm a is appended to the value.

      For example selecting todays date would yield 10.12.07 hh:mm a.

      I really just want for the time to be assumed to be 12:00 PM, and if the user needs to change it they can manually.

      I modified calendar.js as follows:

       getSelectedDateString: function(pattern) {
       if (!this.selectedDate) return "";
       if (!pattern) pattern = this.params.datePattern;
       var formattedDateTime = this.selectedDate.format(pattern, this.params.monthLabels, this.params.monthLabelsShort)
       .replace(/hh/, "12")
       .replace(/mm/, "00")
       .replace(/a/, "PM");
       return formattedDateTime;
       //return this.selectedDate.format(pattern, this.params.monthLabels, this.params.monthLabelsShort);
       },


      in attempt to just replace the hh:mm a with 12:00 PM.

      This works just fine except when I open the calendar the input field is cleared. When selection occurs I get the value I want.

      Please advice on a better solution. I am not looking for a gui type control. I just need something that works until 3.2 comes out.