1
votes

I use [email protected] in My Razor Pages Projekt (.Net Core 2.2).

Datepicker Configuration:

    $('.datepicker').datepicker({
        language: '@currentCulture',
        autoclose: true,
        orientation: "bottom left",
    });

HTML Template:

<input asp-for="ViewModel.DateTimeProperty" data-provide="datepicker" type="text" class="form-control datepicker">

The current language is DE (German). After having selected a date, the format of the displayed date is correct: 14.06.1989. Then I save the data set with the changed DateTime property. The page reloads. Now, the displayed format is: 14.06.1989 00:00:00 How can I prevent the input field to show the time part of the DateTime property?

Thank you very much.

1
Thanks for your comment, @Veljko89. The suggested answers in the mentioned question do not work for me :-( - MatterOfFact

1 Answers

2
votes

For first showing before choosing the date, you could control it by configure DataType like below on the entity.

public class Book
{
    public int Id { get; set; }
    public string Title { get; set; }
    [DataType(DataType.Date)]
    public DateTime CreationTime { get; set; }
}