This is a migrated thread and some comments may be shown as answers.

RadDateInput AM/PM Designators bug?

1 Answer 81 Views
Input
This is a migrated thread and some comments may be shown as answers.
Code Authority, Inc.
Top achievements
Rank 2
Code Authority, Inc. asked on 10 Feb 2009, 12:18 AM

<

 

telerik:RadDateInput ID="txtRequestTime" runat="server" Width="75px" DateFormat="t" DisplayDateFormat="hh:mm tt">

 

</

 

 

telerik:RadDateInput>

How come when I enter a 4p in the box it doesn't resolve to 4:00 PM?  If I do 4PM it works and resolves to 4:00 PM, 4P will always give me 4:00 AM on a blur.  How can I make the this control parse a "p" as "pm" and an "a" as an "am", in addition to the default behavior of specifying AM/PM for the time. 

Using version: 2008.03.1125.35 

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 Feb 2009, 12:59 PM
Hi Jason,

I suppose that in your case the DateInput control has its AM and PM designators set as "am" and "pm". I am afraid that an "intelligent autocomplete" for partial designators is not supported, because there can be an indefinite number of such designators in the different cultures. In addition, custom designators may be set in a given culture server-side.

Here is an easy workaround - you can subscribe to the DateInput's OnValueChanging event, see whether a single "p" is entered and add an "m" manually:

<telerik:RadDateInput ID="RadDateInput1" runat="server" DateFormat="t" DisplayDateFormat="hh:mm tt">
        <ClientEvents OnValueChanging="ValueChanging" />
</DateInput>

Javascript

function ValueChanging(sender, args)
{
    var newValue = args.get_newValue();
    if (newValue.indexOf("p") != -1 && newValue.indexOf("pm") == -1)
    {
        args.set_cancel(true);
        sender.set_value(newValue.replace("p", "pm"));
    }
}


Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
Code Authority, Inc.
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Share this question
or