Kendo datePicker fails to validate for culture pattern on server

0 Answers 38 Views
Date/Time Pickers
Steve
Top achievements
Rank 1
Steve asked on 15 Feb 2022, 02:35 PM | edited on 16 Feb 2022, 12:59 PM

We're using Telerik.UI.for.AspNet.Mvc5.2021.2.511 to input 2 dates.

var culture = System.Globalization.CultureInfo.CurrentCulture.ToString();

<script src="~/Scripts/kendo/2021.2.511/cultures/kendo.culture.@(culture).min.js"></script>

kendo.culture("@culture");


<div class="form-group">
              @Html.LabelFor(m => m.StartDate, new { @class = "col-md-2 control-label" })
             <div class="col-md-10 k-content">
                  @(Html.Kendo().DatePicker()
                        .Name("StartDate")
                       //.Min(DateTime.Today)
                       .Max(new DateTime(2030, 12, 31))
                       .Value(DateTime.Today.AddDays(1))
                      .Events(e => e.Change("startChange"))
                       .Culture(culture)
                  .HtmlAttributes(new { @data_val = "false", validationMessage = @DisplayText.Get("InvalidDateWarning") })
                  )
                </div>
              </div>

             <div class="form-group">
                 @Html.LabelFor(m => m.EndDate, new { @class = "col-md-2 control-label" })
                   <div class="col-md-10 k-content">
                      @(Html.Kendo().DatePicker()
                        .Name("EndDate")
                         .Min(DateTime.Today)
                         .Max(new DateTime(2030, 12, 31))
                        .Value(DateTime.Today.AddDays(1))
                        .Events(e => e.Change("endChange"))
                        .Culture(culture)
                         .HtmlAttributes(new { @data_val = "false", validationMessage = @DisplayText.Get("InvalidDateWarning") })
                   )
                 </div>
              </div>

When this is run locally in VS it works as expected, but once it's published to the server it complains of an invalid date. Using the debug tools in the browser it shows the attached. The Kendo cultures are correct and the input culture is correct and the date value is correct, so I'm at a loss as to what's going wrong.

Originally we were using the suggested Validation framework, but the same scenario was happening, it worked locally but not once published. This happens in both Chrome and Edge.

Has anyone ever experienced this before?

I've tried the same code now against different languages and it seems to be specific to Czech, so far.

It's the spaces.

Telerik, Is this a bug?

No answers yet. Maybe you can help?

Tags
Date/Time Pickers
Asked by
Steve
Top achievements
Rank 1
Share this question
or