DateInput should not display dateformat placeholders when no date is set and not focused

2 posts, 0 answers
  1. Prashant
    Prashant avatar
    10 posts
    Member since:
    Aug 2016

    Posted 23 Oct 2018 Link to this post

    Hi - I'm using Kendo Date Picker and Date Time Picker with Date Input True, also i have update message of date input to change how place holder should display. Her the problem is date format placeholders are displayed even though there is no date set or component is empty. Is there any solution so that place holder gets displayed only when the component is focused?

    My Code as below.

                                dateInput: true,
                                format: "MM-dd-yyyy hh:mm tt",
                                parseFormats: "",
                                min: new Date(1700, 0, 1)
                                messages: {
                                    "month": "__",
                                    "day": "__",
                                    "year": "____",
                                    "hour": "__",
                                    "minute": "__",
                                    "dayperiod": "__"

                                dateInput: true,
                                format: "MM-dd-yyyy",
                                min: new Date(1700, 0, 1)

                                messages: {
                                    month: "__",
                                    year: "____",
                                    day: "__"

  2. Viktor Tachev
    Viktor Tachev avatar
    2491 posts

    Posted 25 Oct 2018 Link to this post

    Hi Prashant, 

    The messages displayed in the DateInput are actually the value of the input element. Removing them can affect how the component behaves and result in unexpected behavior. 

    As an alternative approach I can suggest specifying a custom CSS class for the DateInput and use it to style the text in it differently. Then in the change event remove that class so that selected the date is shown as normal text. The example below outlines the approach:

    Viktor Tachev
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top