DatePicker.js does not support 12-hour time format.
---------------------------------------------------

         Key: TAPESTRY-888
         URL: http://issues.apache.org/jira/browse/TAPESTRY-888
     Project: Tapestry
        Type: Improvement
  Components: Framework  
    Versions: 4.0    
 Environment: n/a
    Reporter: Ryan Holmes
    Priority: Minor


DatePicker.js ignores 'h' and 'a' characters in a date translator pattern. It 
would be nice to support these since they are fairly common.

I would have included a real patch, but DatePicker.js is has an svn:mime-type 
property of application/octet-stream in the repository so I couldn't find an 
easy way to generate one.

The following needs to be added starting at line 805:
    bits['h'] = getHoursAmPm(date);
    bits['hh'] = pad(getHoursAmPm(date),2); 

    bits['a'] = getAmPm(date);

The keys array needs to include these as well:
    var keys = new 
Array('dddd','ddd','dd','d','MMMM','MMM','MM','M','yyyy','yy', 'ss', 's', 'mm',
        'm', 'HH', 'H', 'hh', 'h', 'a');

And these functions need to be added:
function getHoursAmPm(date) {
        var hours = date.getHours();
        if (hours == 0) hours = 12;
        if (hours > 12) hours -= 12;
        return hours;
}

function getAmPm(date) {
        var ampm = "AM";
        if (date.getHours() > 11) ampm = "PM";
        return ampm;
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to