Getting date only from grid inline date picker

8 posts, 0 answers
  1. Henrik
    Henrik avatar
    38 posts
    Member since:
    Nov 2015

    Posted 31 May 2017 Link to this post

    Hi,

     

    I have a grid with inline editing and a date field. Model:

            [DataType(DataType.Date)]
            public DateTime RelevantDate { get; set; }

    Grid:

    cols.Bound(p => p.RelevantDate).Format("{0:yyyy-MM-dd}").EditorTemplateName("DatePicker").Title("Date of change").Width(120);

     

    The DatePicker template is in the Views\Shared\EditorTemplates folder.

     

    My problem is that when I select a date in the grid and hit Submit the parameter model.RelevantDate in the controller method has the selected date and the current time i.e. 2016-04-01 08:19:41. What I would like to have is the date only: 2016-04-01 00:00:00. Is this possible?

     

    Best regards,

    Henrik

  2. Georgi
    Admin
    Georgi avatar
    676 posts

    Posted 31 May 2017 Link to this post

    Hello Henrik,

    The Kendo DatePicker uses JavaScript Date object. Based on the user input it creates Date object with the clients data, since the DatePicker is only for dates, the hours value of the object remains with it's default value. I tried to recreate you situation but it works as expected on my end and the hours are always with their default value. 

    Make sure there is not custom logic that sets the hours. In case there is no such logic please send us runnable project or isolated sample where the issue occurs so we can investigate your exact case and help you more efficiently.

    Regards,
    Georgi
    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. Henrik
    Henrik avatar
    38 posts
    Member since:
    Nov 2015

    Posted 01 Jun 2017 Link to this post

    Hi Georgi,

    I tried to attach a project, but to get it small enough I had to delete all the kendo-files. Can you add the necessary files at your end? The Web\Content\Kendo and scripts\kendo directories.

     

    Best regards,

    Henrik

  4. Henrik
    Henrik avatar
    38 posts
    Member since:
    Nov 2015

    Posted 01 Jun 2017 in reply to Henrik Link to this post

    ...and trying to attach the zip-file again...
  5. Henrik
    Henrik avatar
    38 posts
    Member since:
    Nov 2015

    Posted 01 Jun 2017 in reply to Henrik Link to this post

    ...and trying to attach the file again...
  6. Henrik
    Henrik avatar
    38 posts
    Member since:
    Nov 2015

    Posted 01 Jun 2017 Link to this post

    I keep getting an error when trying to attach a sample project. Is there another way I can send the file?

     

    Henrik

  7. Georgi
    Admin
    Georgi avatar
    676 posts

    Posted 02 Jun 2017 Link to this post

    Hello Henrik,

    Please note that attaching archives in a forum thread is not possible. Nevertheless you can upload the project to a file sharing provider (e.g. DropBox, Google Drive) that is convenient to you and send us the download link. 

    Alternatively, you can open a support ticket and attach the project there. Note that there is a file size limit of 40MB.


    Regards,
    Georgi
    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.
  8. Henrik
    Henrik avatar
    38 posts
    Member since:
    Nov 2015

    Posted 07 Jun 2017 Link to this post

    Thanks, support ticket submitted.

     

    Henrik

Back to Top