[ 
https://issues.apache.org/jira/browse/TAPESTRY-938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesse Kuhnert updated TAPESTRY-938:
-----------------------------------

    Fix Version/s:     (was: 4.1.5)
                   4.1.6

> DatePicker returns only date format pattern when pattern dont contains 
> separators
> ---------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-938
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-938
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0.1
>            Reporter: Christian Nutz
>            Priority: Minor
>             Fix For: 4.1.6
>
>
> With date format patterns like "ddMMMyy" (without separators), the datepicker 
> only returns the pattern itselfs, not the formatted date due to the used 
> regex in DatePicker.js  Calendar.prototype.formatDate. Because I did not 
> found a working regex for this function, I replaced the 
> Calendar.prototype.formatDate function with this:
> Calendar.prototype.formatDate = function()
> {
>         if (this._selectedDate == null)
>                   return "";
>     var d = this._selectedDate;
>     var f = this._format;
>               
>               var gsMonthNames = new Array();
>               var gsDayNames   = new Array();
>               
>               for (var i = 0; i < 12; i++)
>                       gsMonthNames[i] = this._monthNames[i];
>               for (var i = 0; i < 7; i++)
>                       gsDayNames[i]   = this._weekDayNames[i];
>     return f.replace(/(yyyy|yy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,
>         function($1)
>         {
>             switch ($1.toLowerCase())
>             {
>             case 'yyyy': return d.getFullYear();
>             case 'yy':   return d.getFullYear().toString().substr(2,2);
>             case 'mmmm': return gsMonthNames[d.getMonth()];
>             case 'mmm':  return 
> gsMonthNames[d.getMonth()].toString().substr(0, 3);
>             case 'mm':   return pad((d.getMonth() + 1), 2);
>             case 'dddd': return gsDayNames[d.getDay()];
>             case 'ddd':  return gsDayNames[d.getDay()].toString().substr(0, 
> 3);
>             case 'dd':   return pad(d.getDate(), 2);
>             case 'hh':   return pad(((h = d.getHours() % 12) ? h : 12), 2);
>             case 'nn':   return pad(d.getMinutes(), 2);
>             case 'ss':   return pad(d.getSeconds(), 2);
>             case 'a/p':  return d.getHours() < 12 ? 'a' : 'p';
>             }
>         }
>     );
> }
> I'm not a js guru - so don't blame me ;)
> Greets
> Chr.Nutz

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to