DotNetAge:DatePicker DateFormatString Missing

Jun 9, 2009 at 5:26 PM

I place this control in form:
<DotNetAge:DatePicker ID="datePickerPeriodoDe" runat="server" DateFormatString="dd/MM/yyyy" LocID="pt-BR" MaxDateFormat="+0d" />

but, the generated code is:
<script type="text/javascript">
    Sys.Application.add_load(ctl00_contentMain_datePickerPeriodoDe_LoadScript);function ctl00_contentMain_datePickerPeriodoDe_LoadScript()   {$("#ctl00_contentMain_datePickerPeriodoDe").datepicker({maxDate:'+0d',       showOn:'focus',dateFormat:'dd/mm/y'} );Sys.Application.remove_load(ctl00_contentMain_datePickerPeriodoDe_LoadScript);}//]]>

See dateFormat generated is: 'dd/mm/y' this is same a 'dd/MM/yy' in .Net framework and not a 'dd/MM/yyyy' specified in the property DateFormatString="dd/MM/yyyy"

if I declare the control DotNetAge:DatePicker only with the property LocID = "pt-BR" and removing the property DateFormatString = "dd/MM/yyyy" the control is rendered properly but a PostBack is triggered when the date is converted to MM/dd/yyyy automatically causing error.

I will provide more information to fix this problem.

Jun 9, 2009 at 6:30 PM

Thank you for found this bug.By your help i already find the code that cause this bug:

in DatePicker.cs line 1408 this is a private method named "GetjQueryDateFormat" this method convert the .net datetime format to jQuery datetime format,in the part of year convertion you find the code form line 1412 to line 1426

            //Format year
            if (formatted.IndexOf("yy") > -1)
                formatted = formatted.Replace("yy", "y");

            if (formatted.IndexOf("yy") > -1)
                formatted = formatted.Replace("yy", "y");

i had do the convertion twice!The problem is here,do convertion once is enought. So i ready fixed it.

Jun 9, 2009 at 7:34 PM

the problem is solved. THANKS