DatePicker - Input field is of type text and hence doesn't serialize properly

4 posts, 0 answers
  1. François
    François avatar
    5 posts
    Member since:
    Sep 2017

    Posted 02 Oct Link to this post

    The input field generated by DatePicker is of type text. Hence, when I serialize the form in which the input is contained into json, the date is not properly formatted. Especially as the culture of the browser can be anything while the rest service the form is posted to expect a culture-invariant date. The same is true with NumerictextBox by the way.
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1768 posts

    Posted 05 Oct Link to this post

    Hi,

    In order for the Date and numeric values to be parsed correctly we recommend using matching cultures on the client and server. Please examine the article below that describes the approach in more detail.



    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. François
    François avatar
    5 posts
    Member since:
    Sep 2017

    Posted 05 Oct in reply to Viktor Tachev Link to this post

    My first impression is that such coupling would be wrong pratice.

    For example in my case I don't call an MVC action but post data to a web api which expect culture-neutral data. I'll check if specifying a culture per request is a standard REST specification.

  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1768 posts

    Posted 10 Oct Link to this post

    Hi François,

    An alternative approach would be to intercept the values before sending them to the server. This way the date can be converted to the required format.


    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top