Topic: Date-picker jquery creates wrong year and format ASP.Net Core

vonmonckl free asked 4 years ago

I use a the material date-picker with default values. However, a) the format shown adds time ('0:00:00') and the supplied date (e.g. 26 September 2019) shows up as 26 december 2018??.

The HTML code is:

<div class="md-form">
                <input asp-for="TodoStartDate" placeholder="Selected date" type="text" class="form-control datepicker">
                <label asp-for="TodoStartDate"></label>                    

The Model of TodoStartDate is:

    [DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}")]
    [Display(Name = "Start")]
    public DateTime TodoStartDate { get; set; }


screenshot of date-picker

MDBootstrap staff commented 4 years ago

Hi, please generate snippet with your usage of this component. I will try to modify your code to work properly.

Best Regards, Piotr

vonmonckl free commented 4 years ago

I just made a snippet, but it is hard to reproduce the error, as it needs the .Net Core environment as well to read the Date. The Snippet is can be found here:

MDBootstrap staff commented 4 years ago

In the snippet, I can not test it. I obviously understand why. Well, It has to be a problem with the way you post data to the input with the date picker. Are you sure the data you are trying to send is in the proper format? I think that there is everything working fine with our component. It has to be an issue with the setup which currently I can not test. I am not sure how can I help you there. If you want to set the value of the date picker on the start of initialization simply read this part of the documentation:

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.10
  • Device: Desktop
  • Browser: Edge, Chrome
  • OS: Windows10
  • Provided sample code: No
  • Provided link: No