This project is read-only.


MaskedEditExtender fails when MaskType="DateTime" after focus out


AjaxControlToolkit 4.1.51116.0
MaskedEditExtender does not allow the time to be set. When the textbox loses focus the hour and minute are set to the two digit month and two digit day used in the date portion.

<asp:TextBox ID="txtDateTime1" runat="server"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender ID="mskDateTime1" runat="server"
Mask="99/99/9999 99:99" MaskType="DateTime" TargetControlID="txtDateTime1"  
UserTimeFormat="None" AcceptAMPM="false"> 
Closed Mar 13, 2015 at 1:25 PM by fadilmamedov
This ticket was merged with item 26785


Orlangur wrote Jul 31, 2012 at 12:54 PM

The bug happens in cultures using DMY date format

Orlangur wrote Jul 31, 2012 at 1:00 PM

In 3.0.20820 the bug also happened but only when setting culture override to CultureName property (to "ru-RU", for example). In 4.1.60623 it happens even if CultureName is not set.

Orlangur wrote Jul 31, 2012 at 1:26 PM

The error is in AutoFormatTime function:

    if (this._MaskType == Sys.Extended.UI.MaskedEditType.DateTime)
        var arr = this._SplitDateTime(ValueText);
        var time_arr = arr[1].split(" ");
        if (time_arr.length == 2) 
            ValueText = time_arr[0] + " " + time_arr[1];
            ValueText = arr[0];

last line should be:

ValueText = time_arr[0]