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

Format Issues related to Datetime Picker

3 Answers 248 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Sreejesh
Top achievements
Rank 1
Sreejesh asked on 18 Oct 2013, 06:53 AM
Hi,

I am facing the format issues in the DateTime Picker control in the scenario if it behaves as a individual control / when it is placed inside the grid.

Please find the attached document for detailed explanation.

Regards,
Sreejesh

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 22 Oct 2013, 06:54 AM
Hi Sreejesh,

You can find an example showing how to use multiple parseFormats [2] and how to validate the DatePicker here. Additionally I would recommend you to check the Kendo UI Globalization guide, which will help you resolve the default date formatting. I am not sure I understand your questions regarding the ServerOperations option. Could you please clarify and provide a runnable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.
On a side note, I would like to remind you that as a general practice it is accepted to ask different questions in separate support threads. This makes it is much easier to follow and concentrate on the particular issue which usually leads to its faster resolving. For additional information on that topic I suggest to check the following blog post:  

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sreejesh
Top achievements
Rank 1
answered on 23 Oct 2013, 02:07 PM
Hi Alex,

Thanks for your suggestion. It helped me to resolve the date picker formatting issue which I have outside the grid. However, I have a datetimepicker control inside the grid. I am getting the "FinishDateTime is not valid date". 

As you said, I have included the globalization script "kendo.culture.en-GB.min.js" under scripts\cultures folder and set the kendo culture in the script. After  this I an am getting the time in the 24 hours format in the datetimepicker. But only the problem is with the validation message, which fires even for valid date and time.
   
Please refer the below code and the attachment.

Editor template code

@(Html.Kendo().DateTimePickerFor(m => m)
    .Format("dd-MM-yyyy HH:mm")
    .ParseFormats(new string[] { "dd-MM-yyyy HHmm", "dd-MM-yy HHmm", "ddMMyyyy HHmm", "ddMMyy HHmm" })
)

Model code
          /// <summary>
        /// Gets or sets the value of FinishDateTime
        /// </summary>
        [UIHint("MagmaDateTime")]
        [DataType(DataType.DateTime)]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd-MM-yyyy HH:mm}")]
        public DateTime? FinishDateTime
        {
            get;
            set;
        }

Grid column code

 columns.Bound(p => p.FinishDateTime).Width(130).Title("Finish DateTime");

culture settings

 
  bundles.Add(new ScriptBundle("~/bundles/kendoscripts").Include(
                         "~/Scripts/kendo.all.min.js",
                         "~/Scripts/kendo.aspnetmvc.min.js",
                         "~/Scripts/cultures/kendo.culture.en-GB.min.js"));

<script>
    kendo.culture("en-GB");
</script>

Thanks in Advance,
Sreejesh
 
0
Alexander Popov
Telerik team
answered on 25 Oct 2013, 12:29 PM
Hello Sreejesh,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide a runnable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Sreejesh
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Sreejesh
Top achievements
Rank 1
Share this question
or